if __name__ == '__main__': itchat.auto_login(hotReload = True) # hotReload = True, 保持在线,下次运行代码可自动登录,在这期间所有的对方回话都会再一次回覆 # 获取自己的昵称 friends = itchat.get_friends(update=True)[0:] Name = {} Nic = [] User = [] for i in range(len(friends)): Nic.append(friends[i]["NickName"]) User.append(friends[i]["UserName"]) for i in range(len(friends)): Name[Nic[i]] = User[i] itchat.run()