Generate QR code with Python

QR codes have become common in consumer advertising. Typically, a smartphone is used as a QR code scanner, displaying the code and converting it to some useful form.

You can generate QR code in Python in different ways. Here we will see two different modules in python that generates QR code.



Using pyqrcode

Installation

pip install pyqrcode

Usage

import pyqrcode
url = "https://hackzism.blogspot.com/"
qr = pyqrcode.create(url)
qr.svg("hackzism.svg", scale = 10)


Using qrcode

Installation

pip install qrcode
pip install Pillow

Usage

import qrcode

text = "Nothing hacks better than Hackzism!"
filename = "hackzism.png"
qr = qrcode.make(text)
qr.save("hackzism.png")


If you would like to contribute to Hackzism you can also write an article and mail to  hackzism.hack@gmail.com
Your article will be published on our home page.

Comments

Popular Posts