QR Code Generator using Python
QR stands for “Quick Response”. It is a type of matrix barcode that can be read by devices to quickly access some information by just scanning the code with a device. QR Code generator is a program that takes some data as input which can be some text or URL and generates QR Code that has the provided information.
We require to install module named pyqrcode and pypng(To export as PNG) for this project. To install the modules:
pip install pyqrcode
pip install pypng
• Import Modules
• Input data from User
• Use pyqrcode.create() function, which takes user input and will generate the QR Code, and save it to a variable.
• Save QR code as PNG or SVG.
import pyqrcode import png data=input("Enter link or text for QR Code: ") QRcode=pyqrcode.create(data) name=input("Name of the QR Code: ") QRcode.png(name+".png",scale=15) # For PNG format QRcode.svg(name+".svg",scale=15) # For SVG format