美文网首页技术日常
python1~py3解析二维码内容

python1~py3解析二维码内容

作者: 摹喵居士 | 来源:发表于2017-05-05 14:14 被阅读350次

    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解析二维码内容

        本文链接:https://www.haomeiwen.com/subject/vnzjtxtx.html