How to generate QR code using Python
Modules Required
- pip install pyqrcode
- pip install pypng
pyqrcode module is used to generate the QR code and it is written in pure python.
This module is compatible with Python 2.6 , 2.7 and 3.x.
pypng
pypng module is used to save the code in the PNG format.
code
import pyqrcode
import png
from pyqrcode import QRCode
#text which we want to put inside the QR code
text="https://hackingsnippet.blogspot.com/"
#to create the QR code
QR_code = pyqrcode.create(text)
#to save the QR code
QR_code.png('code.png', scale=6)
#to show the QR code generated
QR_code.show()
Output
Comments
Post a Comment