Python正则表达式
Python正则表达式
导入模块
import re
search函数
re.search(pattern, text)
代码:
import re
pattern = 'this'
text = 'Does this text match the pattern?'
match = re.search(pattern, text)
s = match.start()
e = match.end()
print('Found "{}"\nin "{}"\nfrom {} to {}
原创
2021-01-07 22:19:13 ·
105 阅读 ·
0 评论