python之获取微信好友列表并保存文档中

代码如下

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)

猜你喜欢

转载自www.cnblogs.com/qzzhou/p/10486380.html