一、MyQR生成二维码
1.第一种方式:MyQR
pip install qrcode==6.1
# coding=utf-8
"""
@Project :pachong-master
@File :QR_test.py
@Author :gaojs
@Date :2022/8/6 18:42
@Blogs : https://www.gaojs.com.cn
"""
from MyQR import myqr
while True:
temp = input("请输入要生成二维码的网站:")
myqr.run(words=temp, save_name=temp + '.jpg', save_dir='photo')
print(f'******************** {temp} 网站二维码生成完毕 ***********************')
2.第二种方式:
# coding=utf-8
"""
@Project :pachong-master
@File :QR_test.py
@Author :gaojs
@Date :2022/8/7 9:42
@Blogs : https://www.gaojs.com.cn
"""
import qrcode
qr = qrcode.QRCode(
version=10,
error_correction=2,
box_size=10,
border=4
)
qr.add_data("https://www.gaojs.com.cn")
qr.make(fit=True)
img = qr.make_image()
img.save("./photo/blogs.png")