2017年7月4日 星期二

[Python] How to create QRcode

Download python-qrcode library for github

Install dependent library “image”
pip install Image

Jump to python-qrcode

Create example.py under folder of python-qrcode.
Type two kind of code as following example.

import qrcode
img = qrcode.make('http://python.org')
img.show()

Advanced qrcode example

import qrcode
qr = qrcode.QRCode(
    version=1,
    error_correction=qrcode.constants.ERROR_CORRECT_L,
    box_size=10,
    border=4,
)
qr.add_data('Some data')
qr.make(fit=True)

img = qr.make_image()
img.show()

Reference:

0 意見:

張貼留言