Home » Python » Python programs

Python program to generate the QR code in Python

Python QR Code Generator: Here, we will learn how to generate the QR code in the Python programming language?
Submitted by Bipin Kumar, on October 14, 2019

QR code is a short form of the quick response code. It is a type of matrix barcode that contains some information like some specific link, important message, email-id, etc. In Python, the qrcode module is used to generate the QR code of some specific information most easily.

Since the qrcode module is not inbuilt in the Python that why before going to use it, we have to install it by using the below pip command line,

Installation: pip install qrcode

To understand the qrcode module of the Python in a better way, let's try to generate a QR code in python and also save it in a specific drive that will contain the following information.

Information:

    "Includehelp is one of the best sites to learn any programming language from the basics. 
    To visit the site click on the link:  https://www.includehelp.com ."

Algorithm to solve generate QR code

  • Step 1: Initially, we will include the qrcode module in the program by using the import function.
  • Step 2: Generate a QR code of the given information by using the make function of the qrcode module.
  • Step 3: Now, we will save it by giving a specific name with ".png" extension.

Python code to generate QR code

# importing the module
import qrcode 

# information
First_qrcode=qrcode.make(r'Includehelp is one of the best sites to learn any programming language from the basics. To visit the site click on the link:  https://www.includehelp.com .') 

# to see the QR code on the computer screen
First_qrcode.show() 

Output

Python code to generate QR code | output

When we scan the above QR code by using the QR code scanner then we get the information that we have provided above. It is one of the easiest ways to generate the QR code.

Here is the output when I scanned the QR code through the mobile.

Python code to generate QR code | output







Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.