Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/299.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_Regex_Numbers_Digits - Fatal编程技术网

Python 请参见正则表达式中不带特殊字符的数字

Python 请参见正则表达式中不带特殊字符的数字,python,regex,numbers,digits,Python,Regex,Numbers,Digits,我只想看到没有这个特殊字符的数字,python中带有正则表达式的逗号,数字如下: 143000是一个合理的价格 你工作了126479000小时 我只想看到这样的全场比赛: 143000 126479000 您能向我们提供到目前为止您已经实现的功能吗? import re my_text = '1,222,222 test' my_out = re.search(r'[0-9|,]{1,}',my_text).group().replace(',','') print(my_out)

我只想看到没有这个特殊字符的数字,python中带有正则表达式的逗号,数字如下:

143000是一个合理的价格
你工作了126479000小时
我只想看到这样的全场比赛:

143000
126479000

您能向我们提供到目前为止您已经实现的功能吗?
import re


my_text = '1,222,222 test'

my_out = re.search(r'[0-9|,]{1,}',my_text).group().replace(',','')

print(my_out)