Create Personalised QR code using Python

What is a QR Code?

“Personalised QR code using Python”.A Quick Response code is a two-dimensional pictographic code used for its fast readability and comparatively large storage capacity. The code consists of black modules arranged in a square pattern on a white background. The information encoded can be made up of any kind of data.

pyqrcode module is a QR code generator. The module automates most of the building process for creating QR codes. This module attempts to follow the QR code standard as closely as possible. The terminology and the encodings used in pyqrcode come directly from the standard.

First of all, you should know that there is a library in Python called “pyrqcode” which instantly develops QR codes from the data you provide. These ready to install packages are developed by some contributors and Python developers. We can directly install it by installing the below in our command prompt or any default command window.

$ pip install pyqrcode 

By doing this, you can instantly install the package and is ready for our use. Follow up to create it……….

The Python 3.x code is explained below step-by-step blockwise.


import pyqrcode 
from pyqrcode import QRCode

By doing this on your Python IDE, you are calling in the installed package “pyrcode” to your work. This step is as simple as so.



Here you are going to tell your personalised data to Python library so that it can get QR ready for you. You can give any string data. It can be url, your contact number, Facebook page link, Instagram profile or anything like so.


url = pyqrcode.create(s)
url.svg("MY_CUSTOM_QR.svg", scale = 8) 

Here, this is a simple step of giving command to obtain the QR code by typing this command, you are asking it to get your personalised QR code ready in a .png format with declared scale and size to save it in your machine.

The following is the full code for the QR ode generation

# Import QRCode from pyqrcode 
import pyqrcode 
from pyqrcode import QRCode 
# String which represent the QR code 
# Generate QR code 
url = pyqrcode.create(s) 
# Create and save the png file naming "MY_CUSTOM_QR.png" 
url.svg("MY_CUSTOM_QR.svg", scale = 8) 


The following is the QR generated by the above code.

Python Code
Scan the above QR to enter our website

This is one of the coolest thing that can be done using Python. For more such articles, stay tuned here at

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments