Generate QR Code for Website URL using Python

Generate QR Code for Website URL using Python

QR codes are a quick and easy way for sharing information with others. By generating a QR code for your website URL, you can provide a convenient way for users to access your website or online content. In such case, users don't need to manually enter the URL into their browser. This can be especially useful for businesses or marketers who want to promote their website or digital content. This tutorial shows how to generate a QR code for a website URL using Python.

Prepare environment

  • Install the following package using pip:
pip install qrcode[pil]

Code

In the following code, we use the qrcode.make function to generate the QR code image for a given website URL. Finally, we save the QR code image as a PNG file using the img.save function.

import qrcode

img = qrcode.make('https://lindevs.com')
img.save('website.png')

Here is an example of what the QR code image might look like:

Website QR Code Generated using Python

Leave a Comment

Cancel reply

Your email address will not be published.