A QR code or Quick Response code is a type of matrix barcode or two-dimensional barcode invented in 1994 by the Japanese automotive company Denso Wave. A barcode is a machine-readable optical label that contains information about the item to which it is attached. In practice, QR codes often contain data for a locator, identifier, or tracker that points to a website or application. A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to store data efficiently; extensions may also be used.
In this mini python project we will write a program to encode personal info into a QR Code.
Firstly, opening jupyter notebook and importing a qrcode library for QR code generator.
Secondly, we would take the inputs from user. For example, personal information. i,e name and id. Here in second line we can also force the user to enter the id in only numbers by just using int() function.
your_name=input("Enter your name:") your_id=input("Enter your id:")
Third, and most important step is to convert that info into a QR code with qrcode.make function and giving the information as a string. The second line in below cell takes input for a file name on which QR code image should be saved. The third line saves the QR code image with that filename through im.save() function.
img = qrcode.make(your_name+":"+your_id) f_name=input("Enter a name for QR image file must use the '.png' at the end.") img.save(f_name)
Now if you want to show the QR code image, it could be done with img.show() function.
This is the end of a very simple QR Code generator program in python