文章详情页
python的 itchat微信api文档的 itchat.send如何发信息给指定用户?
问题描述
itchat.send_msg(’Hello world’)<ItchatReturnValue: {u’MsgID’: u’’, u’LocalID’: u’’, u’BaseResponse’: {u’ErrMsg’: u’’, u’Ret’: 1204, ’RawMsg’: u’’}}>
不能发给自己信息
itchat.send(’hello’,toUserName = User)
发给别人也不行( User 是一个微信号 )
问题解答
回答1:#想给谁发信息,先查找到这个朋友users = itchat.search_friends(name=u’通讯录备注名’)#找到UserNameuserName = users[0][’UserName’]#然后给他发消息itchat.send(’hello’,toUserName = userName)
或者每直接用这个用户发送
user = itchat.search_friends(name=u’通讯录备注名’)[0]user.send(u’机器人say hello’)
相关文章:
1. debian - docker依赖的aufs-tools源码哪里可以找到啊?2. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?3. docker start -a dockername 老是卡住,什么情况?4. golang - 用IDE看docker源码时的小问题5. macos - mac下docker如何设置代理6. docker-compose 为何找不到配置文件?7. dockerfile - 为什么docker容器启动不了?8. mac连接阿里云docker集群,已经卡了2天了,求问?9. docker pull 错误?10. 在windows下安装docker Toolbox 启动Docker Quickstart Terminal 失败!
排行榜