代码如下

from wxpy import *
from pprint import pprint

#登录微信
bot = Bot()

my_friend = bot.friends()

f = open("friends.txt", 'w', encoding="utf-8")  # 创建friend文件,并将好友信息存进文档

#好友排序
for friend in my_friend:
    line = str(friend) + "\n"
    f.write(line)

 

相关文章: