THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
qrcode的安装
pip install qrcode
再安装Image模块
pip install Image
生成文本二维码
import image
import qrcode
生成二维码到当前路径:
ecode=qrcode.make("232343546")
ecode.save("232343546.png")
生成二维码到指定路径:
ecode=qrcode.make("43243243")
ecode.save("d:\test\43243243.png")
将URL生成二维码:
img=qrcode.make("www.baidu.com")
img.save("baidu.png")
更改生成二维码的样式:大小、宽度等
qr=qrcode.QRCode(version=2,error_correction=qrcode.constants.ERROR_CORRECT_L,box_size=8,border=10)
qr.add_data("this is my test")
qr.make(fit=True)
img=qr.make_image()
img.show()
img.save("mm.png")