itchat 批量给微信好友发送祝福消息

xiaoxiao2021-02-28  104

明天就是元宵节(2018.3.2),微信批量发送祝福消息。

#coding=UTF-8 #基于python3.6 import itchat,time import sys from itchat.content import * itchat.auto_login() wish_list = ['汤圆说:我不开口就是为了让你永远在我心中。水说:我时时刻刻流淌不息就是为了永远把你拥抱。' '锅说:都快熟了还贫呢。值此元宵佳节之际,xxx祝您工作顺利,万事如意,阖家欢乐!'] SINCERE_WISH = wish_list[0] friendList = itchat.get_friends(update=True)[1:] for g in range(0,len(friendList)): itchat.send(SINCERE_WISH,friendList[g]['UserName']) print((friendList[g]['RemarkName'] or friendList[g]['NickName']),'已发送') sys.stdout.write(str(g+1)+"/"+str(len(friendList))+"\r") sys.stdout.flush() time.sleep(2) print('done')

执行效果如下:

转载请注明原文地址: https://www.6miu.com/read-38991.html

最新回复(0)