import re
#re 预编译
pat=re.compile("(.*)----(.*)") #预编译可以加快速度
line="827007914----penghueix"
matchobj=pat.match(line)
print(matchobj.group()) #matchobj.group()等价matchobj.group(0)
print(matchobj.group(0)) #827007914----penghueix
print(matchobj.group(1)) #827007914
print(matchobj.group(2)) #penghueix
Python match 的第二种风格,预编译(compile)
最新推荐文章于 2024-06-01 22:14:47 发布

2150

被折叠的 条评论
为什么被折叠?



