DEV Community

Spandan Sehgal
Spandan Sehgal

Posted on

1

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.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay