Python 微信

代码:

import itchat
itchat.login()
friends = itchat.get_friends(update=True)[0:]

 显示:

friends

好友分类:

male = female = others =0
for i in friends[1:]:
    sex = i["Sex"]
    if sex ==1:
        male +=1
    elif sex ==2:
        female +=1
    else:
        others +=1
total = len(friends[1:])
print("男生:",male)
print("女生:",female)
print("未知:",others)

 

男生: 353
女生: 141
未知: 39

 

posted @ 2017-08-01 17:25  侠之大者kamil  阅读(69)  评论(0)    收藏  举报