人工智能时代来了,对于亲友的拜年微信还在傻傻的一个一个回复吗?那就Out啦。。。。。
那么作为程序员们,大家用什么技术呢?
这里给大家介绍一个使用Python自动拜年攻略哦
![](https://img.haomeiwen.com/i2177661/5421dfe7f692f6d0.png)
2 有python运行环境
![](https://img.haomeiwen.com/i2177661/d8cee596370e5f79.png)
pycharm中新建testWeChatPy.py 代码如下
# -*- coding: utf-8 -*-
# @Time : 2018/2/12 上午11:40
# @Author : scl
# @Email : 1163820757@qq.com
# @File : testWeChatPy.py
# @Software: PyCharm
import itchat
import re #正则库
from itchat.content import *
@itchat.msg_register([TEXT])
def text_reply(msg):
match = re.search('年',msg['Text'])
if match:
itchat.send(('那我祝你狗年大吉大利'),msg['FromUserName'])
@itchat.msg_register([PICTURE,RECORDING,VIDEO,SHARING])
def other_reply(msg):
itchat.send(('那我祝你狗年大吉大利'),msg['FromUserName'])
itchat.auto_login(hotReload=True)
itchat.run()
运行结果
![](https://img.haomeiwen.com/i2177661/24874a69769ebdbf.png)
网友评论