python 生成二维码

#coding:utf8
try:
    import qrcode
except ImportError:
    qrcode = None

class MakeQr:
	def onUseQrcode(self, value):
	        qr = qrcode.QRCode(version=1, box_size=10, border=4)
	        qr.add_data(value)
	        qr.make(fit=True)
	        x = qr.make_image()
	  
	        img_file = open("1.jpg", ‘wb‘)
	        x.save(img_file, ‘JPEG‘)
	        img_file.close()
	        print ‘ok‘
if __name__ == ‘__main__‘:
	value = "http://www.baidu.com"
	makeQr = MakeQr()
	makeQr.onUseQrcode(value)

  

python 生成二维码,布布扣,bubuko.com

python 生成二维码

上一篇:Visual C++中的ADO编程


下一篇:C语言实验——一元二次方程Ⅱ