Generate two-dimensional code with Python

Source: Internet
Author: User

Python generates two-dimensional code that can be used with the QRCode module, GitHub address

I'm a porter.

Install it first, because it is ready to be generated and then displayed, so use the Pillow module

InstallInstall Pillow

Before writing the code, initialize a picture file,

" anything " > Test.png

Now this test.png is already a QR code, and the content after the scan is the "anything" string that was written when it was initialized.
We can use the QRCode module to modify this content.

 from Import ImageIn [import  Qrcodein [3]: img = qrcode.make ('Hello,you' ) ) in [4]: Img.save ('test.png') # Modifies the contents of the QR code and saves it to a file in [5]: img = image.op En ('test.png') in [6]: Img.show () # Show pictures

Just a brief introduction, please refer to the GitHub documentation for advanced usage

Generate two-dimensional code with Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.