使用PyQRCode,我想为下面的图像生成QR代码

中兴解码器在线报告:
Raw text: �R606101.
Raw bytes: 40 98 05 23 63 03 63 13 03 12 e0 ec 11 ec 11 ec这里是我的python脚本
import pyqrcode
import png
from pyqrcode import QRCode
import re
# Raw bytes which represents the QR code
s = "40 98 05 23 63 03 63 13 03 12 e0 ec 11 ec 11 ec"
s = re.sub(r"((?![a-f0-9]).)", "", s)
print(s)
t = bytes.fromhex(s).decode('latin-1')
print(t) # error: it print @˜♣#c♥c‼♥↕àì◄ì◄ì not �R606101.
# Generate QR code
url = pyqrcode.create(t, encoding='latin-1')
# Create and save the png file naming "myqr.png"
url.png('myqr.png', quiet_zone=1, scale = 20) 但是上面的代码会产生奇怪的字符和不同的QR码图像。
发布于 2021-12-07 18:37:23
您可以在从原始字节创建qr代码之前和之后使用解码(‘拉丁语-1’)和编码(‘拉丁语-1’),这使字节变为由pyqrcode标识的字符。
https://stackoverflow.com/questions/63638435
复制相似问题