First of all Download the library qrcode:
pip install qrcode
Code:
# Importing library
import qrcode
# Data to be encoded
data = 'https://ajblogsprogramming.blogspot.com/'
# Encoding data using make() function
img = qrcode.make(data)
# Saving as an image file
img.save('AJBlogs.png')
Output:
Checkout AJ Blogs Programming For More Interesting Programs