关于python返回装饰后函数的结果

注册re_msg的意义在于,告诉itchat每次有符合特定条件的消息,itchat要把消息作为参数,去调用re_msg。
所以一条消息进来,你要做什么,在注册方法里写就好了。
比如你要打印:
import loggingimport itchat@itchat.msg_register(itchat.content.TEXT)def _(msg): logging.warning(msg.text)itchat.auto_login(True)itchat.run() 【关于python返回装饰后函数的结果】 或者存储:
def store_msg(msgContent): logging.warning(\u0026#39;: %s\u0026#39; % msgContent)@itchat.msg_register(itchat.content.TEXT)def _(msg): store_msg(msg.text)


    推荐阅读