import qrcode
def generate_qr(data):
qr = qrcode.QRCode(version=1, box_size=10, border=5)
qr.add_data(data)
qr.make(fit=True)
img = qr.make_image(fill_color="black", back_color="white")
img.save("qr.png")
print("QR code generated!")
text = input("Enter the text to be encoded in QR code: ")
generate_qr(text)
You can change the version, box_size and border to get the qr code as you desire.
Once the code runs, it will save the QR code as an image named "qr.png" in the same directory as the script.
You can change the name or the format of the image.
I trust this helps you! if you have any query you can ask me.
