cover-img

Build Your Own QR Code Using Python

Share your bio via QR code

29 November, 2022

26

26

1

Hello everyone 👋 It's been a long time and I'm back with another blog for you all which will help you to generate your own QR code in just few simple steps by using Python.

python.jpg

So, without further ado let's get started.

Prerequisities

Before deep diving into the code you should be aware of the prerequisities needed.

1.

Python (installed on your system)

2.

Code Editor such as Visual Studio Code

3.

You should know the basics of Python.

Problem Description

Here we'll be taking a link(url) as an input from the user and then a QR code will be generated for the input url. Now you may use this QR code image to share with your friends and it will be redirecting to the input url for which the image was generated whenever someone scans the code.

My Approach

I'll using a Python module called "qrcode" to solve this problem. First create a folder in your system and then open it up in your favourite code editor.
Create a new file called app.py and open it up. Now open your terminal inside the folder and type the following command to install the module.
Wait for sometime till it gets installed on your system.
After it gets installed, import it in your python file. At this point I'd suggest to check out the official documentation of the qrcode module linked below.

Complete Code

You may copy this code or type out in your Python file.

Output

In order to check the output, open up your terminal inside the current folder and type the following command.
If the above command gives an error for you, then you may try out the following:
Then it will ask you for a valid URL.
img

Terminal output

Here I've used my portfolio link and it has already generated a QR code for me. Let's check it out.
img

My Portfolio QR Code (Generated using Python)

Here's my portfolio link:- https://susmita-dey.vercel.app/
You may now test the QR code generated by Python. I've already tested and it works fine.

Conclusion

I hope that you have learned something new via this blog. It's quite simple, easy and super fun. If you have followed this blog, then I'm pretty sure that you have already generated one for yourself.
Now it's time to flex your QR code on your socials. 😜 Feel free to share your feedback and queries in the comments.
Thank you for reading, and let's connect!!!
Happy Hacking 🌻

develevate

26

26

1

develevate

Susmita Dey
Undergrad College Student | Open Sourcer | Web Developer | Graphic Designer @WeMakeDevs | YouTuber | Contributor @GSSoC'22 | Project Admin @SSOC"22

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2024. Showcase Creators Inc. All rights reserved.