Python之二维码扫描器

246 阅读1分钟

安装模块

pip install pyzbar

pip install pillow

应用

扫描二维码内容

import pyzbar.pyzbar as pyzbar
from PIL import Image
img = Image.open('code1.png')
texts = pyzbar.decode(img)
# 输出结果
for text in texts:
    content = text.data.decode("utf-8")
    print(content)