Python发送微信消息

针对此 需要安装itchat第三方模块

采用pip安装就可以了   pip install itchat

import itchat
import time
#引入时间函数进行测试
time_format='%Y-%d-%m %X'
time_current=time.strftime(time_format)

#itchat.auto_login()#python登录扫描二维码 每次登陆都需要产生二维码
itchat.auto_login(hotReload = True) #第一次扫描 后面就不需要扫描了吗?待测试
users=itchat.search_friends("王豪文")
userName= users[0]['UserName']
itchat.send('你好王豪文,now is %s'%time_current,toUserName=userName)

猜你喜欢

转载自www.cnblogs.com/nodchen/p/8946458.html
今日推荐