DEV Community

Spandan
Spandan

Posted on

How to make a QR Code generator in Python

Intro

Wassup my coder friends ?
Welcome back to another post, so in this post I will be going to show you how to make a QR CODE generator in Python, So let's get started !

Modules required

  1. pyqrcode : it is a module that helps us generate QR code easily

Let's Code !

First we need to import the required modules so lets import them

import pyqrcode 
from pyqrcode import QRCode 
Enter fullscreen mode Exit fullscreen mode

Now lets ask user that what should the qr code contain and generate it

data = input("Enter the data to be encoded in the Qr Code: ")
code = pyqrcode.create(data) 
Enter fullscreen mode Exit fullscreen mode

And now we will save the QR CODE in a png file

code.png("qr.png", scale=8)
Enter fullscreen mode Exit fullscreen mode

And with that done we have successfully created our another project!

I hope you all enjoyed this post meet you in the next post till then stay safe and do take very good care of yourselves.

Comment QR CODE OP if you see this and also feel free to suggest / ask something in the comments section below.

Latest comments (0)