Tutorials  Articles  Notifications  Login  Signup


RK

Rajan Kumar

Founder at HackersFriend Updated Jan. 3, 2020, 7:12 p.m. ⋅ 1560 views

Generate QR Code using python with pyqrcode module


We can easily generate QR codes with python using pyqrcode module. It takes a string as input and generate QR code is expected format, having the string we gave as input. pyqrcode module follows standards of QR code.

Here is an implemetation of it.

Let's start by installing the pyqrcode module.

pip install pyqrcode

Here is sample code to generate QR code with www.hackersfriend.com as information in it.

 

# Import QRCode from pyqrcode 
import pyqrcode 
from pyqrcode import QRCode 


# String which represent the QR code 
s = "www.hackersfriend.com"

# Generate QR code 
url = pyqrcode.create(s) 

# Create and save the png file naming "hackersfriend.svg" 
url.svg("hackersfriend.svg", scale = 8)

 

Here is what is generates:

QR code of Hackersfriend




HackerFriend Logo

Join the community of 1 Lakh+ Developers

Create a free account and get access to tutorials, jobs, hackathons, developer events and neatly written articles.


Create a free account