本站二维码,python代码

本网地址:http://cnliutz.ipyingshe.net
import qrcode

# 生成二维码
data = "http://cnliutz.ipyingshe.net"
img = qrcode.make(data)

# 将二维码保存为图片
with open('qrcode.png', 'wb') as f:
    img.save(f)
    img.open(f)
import qrcode
qr = qrcode.QRCode(version=1,box_size=10,border=5)
data = input("Enter the url you want as a QR code: ")
qr.add_data(data)
qr.make(fit=True)
img = qr.make_image(fill_color="black", back_color="white")
img.save("qrcode.png")