python微信自动回复

模块是itchat

下载:命令行输入 pip install itchat

import itchat

#导入itchat模块

itchat.auto_login()
#登陆微信,授权

用命令行发送给某人单独消息:

users = itchat.search_friends(name=u'通讯录备注名')
#找到UserName
userName = users[0]['UserName']
#然后给他发消息
itchat.send('hello world',toUserName = userName)

自动回复python代码:

import itchat

@itchat.msg_register(itchat.content.TEXT)
def text_reply(msg):
    return u'[自动回复]您好,我现在有事不在,一会再和您联系。\n已经收到您的的信息:%s\n' % (msg['Text'])

itchat.auto_login()
itchat.run()

上一篇:pycharm激活码


下一篇:javascript之Map