python1~py3解析二维码内容

2017.05.05

python3把二维码图片解析成字符串

安装zbarlight

from PIL import Image
import zbarlight

file_path = 'qr.jpeg'
with open(file_path, 'rb') as image_file:
    image = Image.open(image_file)
    image.load()

codes = zbarlight.scan_codes('qrcode', image)
print('QR codes: %s' % bytes.decode(codes[0]))

你可能感兴趣的:(python1~py3解析二维码内容)