import zlib
import base64
import qrcode as qrcode
with open("text_file.txt", "rb") as f:
text = f.read().decode("utf-8")
# 将文本转换为二进制数据
binary_data = zlib.compress(text.encode("utf-8"))
# 将二进制数据编码为base64字符串
base64_data = base64.b64encode(binary_data).decode("utf-8")
# 生成二维码
qrcode = qrcode.QRCode(version=1, box_size=10, border=5)
qrcode.add_data(base64_data)
xxxxxxxxxxxx
python脚本
于 2023-12-19 23:25:52 首次发布