QRCode official website
https://pypi.python.org/pypi/qrcode/5.1
Brief introduction
Python-qrcode is a third-party module used to generate two-dimensional code images, depending on the PIL module and the QRCode library.
Simple usage
Import= Qrcode.make ('Hello, qrcode') img.save (' Test.png')
Advanced usage
Import= qrcode. QRCode ( version=1, error_correction=Qrcode.constants.ERROR_CORRECT_L, box_size =10, border=4,) qr.add_data ('Hello, qrcode') Qr.make (Fit=True) = qr.make_image () img.save ('123.png ')
Parameter meaning:
Version: An integer value of 1~40 that controls the size of the QR code (the minimum value is 1, which is a 12x12 matrix). If you want the program to determine automatically, set the value to None and use the Fit parameter.
Error_correction: Control the error correction function of QR code. The following 4 constants are desirable values.
error_correct_l: About 7% or fewer errors can be corrected.
Error_correct_m (default): Errors of approximately 15% or less can be corrected.
Ror_correct_h: About 30% or fewer errors can be corrected.
Box_size: Controls the number of pixels that each small lattice in the QR code contains.
Border: Control border (the distance between the QR code and the picture boundary) contains the number of squares (the default is 4, which is the minimum value specified by the relevant standard)
Python generates two-dimensional code using the QRCode module