python 正则表达式

([0-9x]+)

re.match('正则',字符串),从开头匹配

re.search('正则,字符串'),查找。

如果存在,使用span方法查看位置,返回元组

if re.match('\t([0-9]+)\t \[',line):
    tuple1 = re.match('\t([0-9]+)\t \[',line).span()
    

 

posted @ 2019-06-20 22:49  61355ing  阅读(80)  评论(0编辑  收藏  举报