Skip to main content

Simple code to Generate QR Code using Python

To generate QR Code like Below

It is important to install pyqrcode and pypng. To install this you can use the command prompt and use the below command.

pip install pyqrcode
pip install pypng

Below simple 5 line code will generate QR code for URL in python

#QR Code Generator
import pyqrcode
from pyqrcode import QRCode
urlDest = 'https://www.ethosspace.com/'
varQR = QRCode(urlDest, error='H', version=None, mode=None, encoding='iso-8859-1')
varQR.png('generatedQR.png', scale=8)
varQR.show()

Here in dest variable, we have used hyperlink ethosspace.com. Which can be replaced with url to generate QR Code.