Python如何在数组中检索数据

2024-04-19 15:03:42 发布

您现在位置:Python中文网/ 问答频道 /正文

首先,我不确定这是不是一个数组。但这是pyzbar解码QRcode的图像

>>> from pyzbar.pyzbar import decode
>>> from PIL import Image
>>> barcode = decode(Image.open('qr111.png'))
>>> print(barcode)
[Decoded(data='812', type='QRCODE', rect=Rect(left=1166, top=306, width=336, height=336), polygon=[Point(x=1166, y=306), Point(x=1166, y=642), Point(x=1502, y=642), Point(x=1502, y=306)])]

我想具体检索数据的值“812”,我该怎么做? 我尝试打印(条形码[解码(数据)],但没有成功。在


Tags: 数据from图像imageimportpil数组open