""" 匹配所有能够表示Python整数的字符串集 """ patt = '[-+]?\d+' # "?"代表前面的正则表达式匹配0次或者1次 m = re.match(patt,'98654') if m is not None: print(m.group())
正则表达式中的?表示匹配前面的正则表达式0次或者1次
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
python私有方法和变量
智普python
2020-07-02 10:06:23
appium自动化测试框架构建
智普python
2020-07-02 10:06:21
python类继承时构造函数的执行问题
智普python
2020-07-02 10:06:21
[Python]正则表达式-不完全使用
seinelee
2020-06-15 05:03:36
用正则表达式解锁IP地址那点事:何在正则表达式中查找和验证IP地址
Jack Py Yan-Digieek
2020-05-12 04:06:06
Node.js的helloworld 程序
智普python
2020-02-23 17:26:48
Node.js小Http服务器
智普python
2020-02-23 17:26:38
pyhton正则表达式学习
倔强不倒翁
2020-02-22 14:09:11
Python正则表达式-基础
無極傷感
2019-04-15 12:55:41
用正则表达式爬取链接和标题
yedoubushishen
2020-07-04 03:42:10
python私有方法和变量
智普python
2020-07-02 10:06:23
appium自动化测试框架构建
智普python
2020-07-02 10:06:21
python类继承时构造函数的执行问题
智普python
2020-07-02 10:06:21
24小時熱門文章