import re #正则表达式模块
data=‘Python is the best language in the world’
result=re.match(‘P’,data) #精确匹配 从起始位置匹配
print(type(result)) #返回<class ‘re.Match’>
print(result.group()) #获取匹配结果
03-02
24万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
import re #正则表达式模块
data=‘Python is the best language in the world’
result=re.match(‘P’,data) #精确匹配 从起始位置匹配
print(type(result)) #返回<class ‘re.Match’>
print(result.group()) #获取匹配结果