superupkeep:993110:viewcounts
superupkeep:22110:viewcounts
处理后
993110
22110
问一下 如上格式的如何正则去除冒号左右俩边的数据?
superupkeep:993110:viewcounts
superupkeep:22110:viewcounts
处理后
993110
22110
问一下 如上格式的如何正则去除冒号左右俩边的数据?
str = "superupkeep:993110:viewcounts"
result = re.search(r":(\d+):", str)
result.group(1)
str = "superupkeep:993110:viewcounts"
pattern=re.compile(r'.?:(.?):.*?')
rst=re.findall(pattern,str)
4 回答4.4k 阅读✓ 已解决
4 回答3.8k 阅读✓ 已解决
3 回答2.1k 阅读✓ 已解决
1 回答4.5k 阅读✓ 已解决
1 回答3.8k 阅读✓ 已解决
1 回答2.8k 阅读✓ 已解决
2 回答1.9k 阅读✓ 已解决
这个其实不用正则匹配,用split就好了.