1. 程式人生 > >python之獲取微信好友列表並保存文檔中

python之獲取微信好友列表並保存文檔中

clas 排序 span 獲取 pan 登錄 int ppr open

代碼如下

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)

python之獲取微信好友列表並保存文檔中