File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import qrcode
22
3- url = input ("Enter the URL: " ).strip ()
4- # before qrcode.png add you desired path where it'll show you qrcode.
5- # for eg : c:\\desktop\\myfile\\qrcode.png
6- file_path = "qrcode.png"
73
8- qr = qrcode . QRCode ()
9- qr . add_data ( url )
4+ def generate_qr_code ():
5+ url = input ( "Enter the URL: " ). strip ( )
106
11- img = qr .make_image ()
12- img .save (file_path )
7+ if not url :
8+ print ("No URL entered. Exiting." )
9+ return
1310
14- print ("QR code is generated!" )
11+ # before qrcode.png, add your desired path where it'll show the qrcode.
12+ # for eg: c:\\desktop\\myfile\\qrcode.png
13+ file_path = "qrcode.png"
14+
15+ qr = qrcode .QRCode ()
16+ qr .add_data (url )
17+
18+ img = qr .make_image ()
19+ img .save (file_path )
20+
21+ print ("QR code is generated!" )
22+
23+
24+ if __name__ == "__main__" :
25+ generate_qr_code ()
You can’t perform that action at this time.
0 commit comments