-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqr.py
More file actions
30 lines (23 loc) · 784 Bytes
/
Copy pathqr.py
File metadata and controls
30 lines (23 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import qrcode
# Collect user information
name = input("Enter your name: ")
address = input("Enter your address: ")
contact = input("Enter your contact number: ")
profession = input("Enter your profession: ")
# Create the data string for QR code
data = f"Name: {name}\nAddress: {address}\nContact: {contact}\nProfession: {profession}"
# Generate QR code
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
# Add data to QR code
qr.add_data(data)
qr.make(fit=True)
# Create the QR code image
img = qr.make_image(fill="black", back_color="white")
# Save the QR code as an image file
img.save("user_info_qrcode.png")
print("QR Code generated and saved as 'user_info_qrcode.png'")