首页 > 其他 > 详细

正则表达式统计字符串中数字的个数

时间:2018-04-06 15:58:02      阅读:196      评论:0      收藏:0      [点我收藏+]

#coding=utf-8
import string
import re
str=‘i have 300 yuan, you 234 234 give me 200 again, then i have 500 yuan‘
iList= re.findall(r"\d+",str)
print "string:",str
print "total digit number:",len(iList)

 

技术分享图片

 

正则表达式统计字符串中数字的个数

原文:https://www.cnblogs.com/xiaxiaoxu/p/8727910.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!