Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从不带逗号的字符串中提取多个数字_Python - Fatal编程技术网

Python 从不带逗号的字符串中提取多个数字

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

我最近尝试使用我的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 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

那么你想加入数字?那么你想加入数字?成功了!非常感谢你!成功了!非常感谢你!