WeChat, launched by Tencent on January 21, 2011, is a free application providing instant messaging service for smart terminals. It was created by the product team of Tencent Guangzhou R&D Center led by Zhang Xiaolong. With the rapid development of the Internet and the demand of the public, wechat has been updated to 2.6.2.31 version, which is the era of wechat for all people. Aunt Zhang in the village, the old father in the family all know how to use wechat.

But when we chat with friends, relatives, lovers, I estimate that everyone has experienced, that is wechat retraction function mentioned, the other party to withdraw a message.

A retracted message is like a secret you want to know more about. Or as a decoy, instantly arousing your intense interest. You want to know, what kind of sentence is that? Is it an inadvertent truth, or a statement directed to the wrong person?

All in all, the news of the retraction was a shock. This is where the technicians come in.

英 文 解 决 信 息 请 求 code:

739021630import itchat from itchat.content import * import OS import time import xml.dom.minidom This is the directory of files where the retraction messages are saved (e.g. Images, voice, etc.), temp = 'C: / Users/Administrator/Desktop/CrawlerDemo' + '/' + 'withdrawal news' if not OS. The path. The exists (temp) : Dict = {} # Define a dictionary # This is a decorator that adds new functionality to the following functions # Capture messages sent by friends, Msg_register ([TEXT, PICTURE, FRIENDS, CARD, MAP, SHARING, RECORDING, ATTACHMENT, VIDEO]) Image def resever_info (MSG) : Global dict # declare global variables info = MSG ['Text'] # Retrieve message content msgId = MSG [' msgId '] # Retrieve message id info_type = MSG ['Type'] # Retrieve message Type name = MSG ['FileName'] # fetch the name of the message sender and retrieve fromUser from the friends list Itchat.search_friends (userName= MSG ['FromUserName'])['NickName'] ticks = MSG ['CreateTime'] time_local = Time.localtime (ticks) dt = time.strftime("%Y-%m-%d %H:% m :%S", time_local) Dict [msgId] = {"info": info, "info_type": info_type, "name": name, "fromUser": fromUser, "dt": "info_type": info_type, "name": name, "fromUser": fromUser, "dt": Def note_info(MSG): [email protected]_register (NOTE) If 'in MSG ['Text'] =' in MSG ['Text']: < Content = MSG ['Content'] . Doc = XML parsing XML dom. Minidom. ParseString (content) # remove msgid label value result = doc. GetElementsByTagName (" msgid ") # The msgId is the message id to withdraw, MsgId = result[0].childNodes[0].nodeValue # The message type that corresponds to the message identifier is retrieved from the dictionary. Msg_type = dict[msgId]['info_type'] if msg_type == 'Recording': Dict [msgId]['info'] # Retrieve message content info_name = dict[msgId]['name'] # Retrieve message file fromUser = Dict [msgId]['fromUser'] # Retrieve sender dt = dict[msgId]['dt'] # Retrieve sender time recording_info(temp + '/' + info_name) # Save voice Send_msg = '[sender:]' + fromUser + '\n' + 'send time :' + dt + '\n' +' Itchat.send_file (temp + '/' + info_name, 'fileHelper ') del dict[msgId] # print(" save voice ") elif msg_type == 'Text': Dict [msgId]['info'] # Retrieve message content fromUser = dict[msgId]['fromUser'] # Retrieve sender dt = dict[msgId]['dt'] # Send_msg = '[sender:]' + fromUser + '\n' + 'Send time :' + dt + '\n' +' Withdraw content :' + text_info # Send prompt message to file helper Itchat. send(send_msg, 'fileHelper ') del dict[msgId] # print(" save text ") elif msg_type == 'Picture': Picture_info = dict[msgId]['info'] # Fetching message contents fromUser = dict[msgId]['fromUser'] # Fetching sender dt = dict[msgId]['dt'] # Info_name = dict[msgId]['name'] # picture_info(temp + '/' + info_name) # picture_info(temp + '/' + info_name) + fromUser + '\n' + 'send time :' + dt + '\n' +' withdraw an image 'itchat.send(send_msg, Itchat.send_file (temp + '/' + info_name, 'fileHelper ') del dict[msgId] # print(" save picture ") itchat.run()Copy the code

That’s the end of this article, but if you’re dating a boyfriend or a girlfriend, don’t look in Python. It’s better not to know than not to know. Experience. After all, curiosity killed the cat

① More than 3000 Python e-books are available

Python development environment installation tutorial

③Python400 self-study videos are available

(4) Software development commonly used vocabulary

The Python learning roadmap is as follows

⑥ Project source code case sharing

If you use to get words can directly take away, in my QQ technology communication group group number: 739021630 (pure technical communication and resource sharing, advertising does not enter) to self-help take away

Click here to claim