loading...
Cover image for QR Code Generator and Reader in Python

QR Code Generator and Reader in Python

codesnail profile image CodeSnail (Arpit) Updated on ・1 min read

QR code generator

import pyqrcode 
import png 
from PIL import Image 

s = "https://www.codesnail.com" 
url = pyqrcode.create(s) 

img = "codesnail-qr-code.png" 
url.png(img, scale=10) 

#opening image 
im=Image.open(img) 
im.show() 

for installation guide: click me

QR code reader

from pyzbar.pyzbar import decode 
from PIL import Image 

d = decode(Image.open("codesnail-qr-code.png")) 
# print(d) 
print(d[0].data.decode()) 

for installation guide: click me

Happy coding :)

Discussion

markdown guide