标签:span smart mamicode box show 简易 nbsp imp pillow
首先要的配置:
pillow image qrcode zxing
然后直接上代码:
1 import PIL 2 import qrcode 3 # 实例化二维码生成类 4 qr = qrcode.QRCode( 5 version=1, 6 error_correction=qrcode.constants.ERROR_CORRECT_L, 7 box_size=10, 8 border=4, 9 ) 10 # 设置二维码数据 11 data = "https://www.cnblogs.com/smartisn/" 12 qr.add_data(data=data) 13 # 启用二维码颜色设置 14 qr.make(fit=True) 15 img = qr.make_image(fill_color="black", back_color="white") 16 17 # 显示二维码 18 img.show()
标签:span smart mamicode box show 简易 nbsp imp pillow
原文地址:https://www.cnblogs.com/smartisn/p/11890465.html