Generate QR code using Python

Posted by Afsal on 23-Dec-2022

Hi Pythonistas!

Today we will learn how to make QR using Python. For that, we are using a package called pyqrcode. It required only 3 lines of code to generate a QR code. In this example, we create a QR code containing the parseltongue’s URL. Let us dive into the code

Code

import pyqrcode
qr_code = pyqrcode.create("https://parseltongue.co.in")
qr_code.svg('qrcode.svg')

Output

File called qrcode.svg is generated in the current folder.

If we scan the QR code we can see that URL is encoded in this QR code. To learn more about this package please click here.

I hope you have learned something from the post. Please share your valuable suggestion with afsal@parseltongue.co.in