Python 从不带逗号的字符串中提取多个数字
我最近尝试使用我的RFID卡的UID,但我希望UID类似于Python 从不带逗号的字符串中提取多个数字,python,Python,我最近尝试使用我的RFID卡的UID,但我希望UID类似于11217924711571,而不是[11217924715157]。我尝试了int(re.search(r'\d+',uid\u str).group()),但它只返回112。谁能帮帮我吗?你可以试试这个: old = [112, 179, 247, 115, 71] new = ''.join(map(str, old)) # will be a str new_int = int(new) # if you need it to b
11217924711571
,而不是[11217924715157]
。我尝试了int(re.search(r'\d+',uid\u str).group())
,但它只返回112
。谁能帮帮我吗?你可以试试这个:
old = [112, 179, 247, 115, 71]
new = ''.join(map(str, old)) # will be a str
new_int = int(new) # if you need it to be an integer, convert it
你可以试试这个:
old = [112, 179, 247, 115, 71]
new = ''.join(map(str, old)) # will be a str
new_int = int(new) # if you need it to be an integer, convert it
那么你想加入数字?那么你想加入数字?成功了!非常感谢你!成功了!非常感谢你!