pythonの捕まえる微信の友达のニックネーム、性別、都市、個性の署名
1212 ワード
あまり話さないで、直接コードをつけます.
#!/user/bin/env python\
# -*- coding: utf-8 -*-
"""
@ Project: Wechat
@ File : getMessage.py
@ Author : Cheng
@ Data : 2019/5/2 23:53
@ Desc :
"""
import itchat
import data
#itchat.login()
itchat.auto_login(hotReload=True)
# , json
friends = itchat.get_friends(update=True)[0:]
#
count = len(friends)
print(' :', count)
def get_var(var):
variable = []
for i in friends:
value = i[var]
variable.append(value)
return variable
NickName = get_var("NickName")
Sex = get_var("Sex") # 1, 2
Province = get_var("Province")
City = get_var("City")
Signature = get_var("Signature")
Framedata = {'NickName': NickName, 'Sex': Sex, 'Province': Province, 'City': City, 'Signature': Signature}
for i in Framedata.items():
print(i)
for i in range(len(friends)): #
Framedata2 = {'NickName': NickName[i], 'Sex': Sex[i], 'Province': Province[i], 'City': City[i], 'Signature': Signature[i]}
print(Framedata2)