用python发送微信

NO.004|86673188

1.完整教程

1.1模块安装

这里我们需要用到python的itchat

pip install itchat

可以用以上命令安装

1.2导入模块

import itchat

1.3登录

itchat.auto_login()

注意:auto_login()函数中有一个参数为是否热登录1如果需要就吧auto_login()改为auto_login(Ture)

1.4寻找用户

users=itchat.search_friends(name='收到消息的人的备注名')
userName=users[0]['UserName']

1.5发送消息

1.5.1发送文字消息

itchat.send_msg('要发送的消息',toUserName=userName)

1.5.2发送图片

itchat.send_image('要发送的图片路径和图片名',toUserName=userName)

1.5.3发送文件

itchat.send_file('要发送的文件路径和文件名'toUserName=userName)

1.5.4发送视频

itchat,send_video('要发送的视频路径和视频名',toUserName=userName)

1.6退出登录

itchat.logout()

2.完整代码

这么简单的教程需要有完整代码吗?

3.源码下载

这么简单的教程需要有源码吗?

4历史文章

1.用Python写一个输入任意内容自动下载图片的程序
2.如何解决pyinstaller报错UnicodeDecodeError
3.Python yagmail库发送邮件
文末惊喜:
小伙伴们可以点击这里参与抽奖,这次没抽中的小伙伴们不用气馁,抽奖是常有的。


  1. 在一定时间内无需授权即可登录 ↩︎

发布了6 篇原创文章 · 获赞 4 · 访问量 2340

猜你喜欢

转载自blog.csdn.net/weixin_43331991/article/details/86673188