How to generate a QR code with Python
A small experiment to generate a QR code using Python and the qrcode library.
TL;DR Too lazy to read? Click here.QR codes spark a lot of interest, but also raise questions among users.
So I decided to put together a short tutorial on how to create/generate one of these codes.
(We’ll use the qrcode and OpenCV libraries.)
Dependencies:
pip3 install pillow qrcode
Now we can generate our QR code!
import qrcode
# Exemplo de data
data = "https://www.linkedin.com/in/diegopisani/"
# Nomeamos o arquivo
filename = 'qrcode.png'
# Geramos o QR Code
img = qrcode.make(data)
# Salvamos a img num file
img.save(filename)
This code will generate a QR code pointing to LinkedIn (in this case, my profile).
And that’s the tutorial o/