【发布时间】:2020-09-12 17:38:25
【问题描述】:
[[Decoded(data=b'AZ:HP7CXNGSUFEPZCO4GS5RQPY6XY', rect=Rect(left=37, top=152, width=94, height=97)),Decoded(data=b'AZ:1EBWZS6F15BDFNK7SK5Y5N3X5U', rect=Rect(left=2616, top=1414, width=108, height=122))], [Decoded(data=b'AZ:9475EFWZCNARPEJEZEMXDFHIBI', rect=Rect(left=32, top=191, width=90, height=88)),Decoded(data=b'AZ:1EBWZS6F15BDFNK7SK5Y5N3X5U', rect=Rect(left=2616, top=1414, width=108, height=122))], [Decoded(data=b'AZ:6ECWZUQGEJCR5EZXDH9URCN53M', rect=Rect(left=48, top=183, width=88, height=89))], [Decoded(data=b'AZ:XZ9P6KTDGREM5KIXUO9IHCTKAQ', rect=Rect(left=73, top=121, width=91, height=94))]]
我有一个类似上面的列表,上面的列表名为result。
现在我只想从列表中的所有列表中提取 AZ:HP7CXNGSUFEPZCO4GS5RQPY6XY 。
我试过了
循环检测到的条形码
for barcode in result:
# the barcode data is a bytes object so if we want to draw it on
# our output image we need to convert it to a string first
barcodeData = barcode.data.decode("utf-8")
但是我收到了list object has no attribute "data ",所以我很困惑如何只提取重要信息。
【问题讨论】:
标签: python list image barcode-scanner nested-lists