代码示例:
import qrcode ##需要下载这两个第三方模块后,才能导入
import image
img = qrcode.make('http://www.baidu.com')
img.save('hello.png')
代码示例:
import random
import time
import itchat
itchat.auto_login() #生成登录二维码
friends = itchat.get_friends() #获取微信好友列表
info = {}
for friend in friends[1:]: #循环统计好友列表的性别
if friend['Sex'] == 1:
info['male'] = info.get('male',0) + 1
elif friend['Sex'] == 2:
info['female'] = info.get('female',0) + 1
else:
info['other'] = info.get('other',0) + 1
print(info)