python

Python-QRCode模块,生成二维码

2016-07-19  本文已影响102人  望月成三人

Usage
From the command line, use the installed qr
script:

qr "Some text" > test.png

Or in Python, use the make
shortcut function:

import qrcodeimg = qrcode.make('Some data here')

Advanced Usage
For more control, use the QRCode
class. For 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()

解释一下:

更多看官网https://pypi.python.org/pypi/qrcode/5.1

上一篇 下一篇

猜你喜欢

热点阅读