使用正则提取RMB1293里面的数字输出整数1293
可以使用以下正则表达式来提取数字:
import re
text = 'RMB1,293'
pattern = r'\d+'
result = re.findall(pattern, text)
print(int(''.join(result)))
输出结果为:
1293
原文地址: https://www.cveoy.top/t/topic/idAx 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
可以使用以下正则表达式来提取数字:
import re
text = 'RMB1,293'
pattern = r'\d+'
result = re.findall(pattern, text)
print(int(''.join(result)))
输出结果为:
1293
原文地址: https://www.cveoy.top/t/topic/idAx 著作权归作者所有。请勿转载和采集!