Djony Cooper Asked:2024-12-04 19:29:03 +0800 CST2024-12-04 19:29:03 +0800 CST 2024-12-04 19:29:03 +0800 CST 使用Python解码条形码 772 我有一个条形码(字体 EanBwrP36Tt): 更准确地说,它是通过解析 Excel 文件获得的值(使用 openpyxl 库): %!50BJ1F-idjbai! 我需要来自:%!50BJ1F-idjbai! -获取-2501915839108 我用谷歌搜索的所有内容,Python 库都提供下载图像作为源,但这不适合我。 是否可以使用Python获取我需要的值? python 1 个回答 Voted Best Answer strawdog 2024-12-04T20:20:41+08:002024-12-04T20:20:41+08:00 您进行映射(例如,使用此数据),然后进行简单的替换: bar_mapping = {"#": 0, "$": 1, "%": 2, "&": 3, "'": 4, "(": 5, ")": 6, "*": 7, "+": 8, ",": 9, "a": 0, "b": 1, "c": 2, "d": 3, "e": 4, "f": 5, "g": 6, "h": 7, "i": 8, "j": 9, "k": 0, "l": 1, "m": 2, "n": 3, "o": 4, "p": 5, "q": 6, "r": 7, "s": 8, "t": 9} a = "%!50BJ1F-idjbai!" res = "".join([str(bar_mapping.get(x, "")) if not x.isdigit() else str(x) for x in a.lower()]) print(res) 2501915839108
您进行映射(例如,使用此数据),然后进行简单的替换: