Python中re.compile遇到only supports 100 named groups的问题
来源:互联网 发布:爰淘宝 编辑:程序博客网 时间:2024/06/04 22:24
#牧飞(mufei)
#Python中re.compile遇到only supports 100 named groups的问题
今天要Python弄个正则表达式来匹配, 发现有个"AssertionError: sorry, but this version only supports 100 named groups"错误.
>>> import re
>>> re.compile('(.moofei)'*100)
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python27\lib\re.py", line 194, in compile
return _compile(pattern, flags)
File "C:\Python27\lib\re.py", line 249, in _compile
p = sre_compile.compile(pattern, flags)
File "C:\Python27\lib\sre_compile.py", line 583, in compile
"sorry, but this version only supports 100 named groups"
AssertionError: sorry, but this version only supports 100 named groups
网上搜了一下解决办法都是用for循环来匹配来解决.
我想了一下不用命名groups也可以解决问题, 在.前面加个?:完美解决问题.
>>> re.compile('(?:.mufei)'*100)
<_sre.SRE_Pattern object at 0x0000000004AAEAA0>
- Python中re.compile遇到only supports 100 named groups的问题
- python中re模块的group()和groups()
- python re模块的(...),group(),groups()
- python re.findall 遇到的小问题
- Python-Web运行环境搭建中遇到的问题-(ImportError: No module named setuptools)
- SQLite only supports TYPE_FORWARD_ONLY 不支持游标移动的问题
- mvn compile遇到的问题:
- Python中正则表达式re模块-compile()和findall()
- mvn compile遇到的问题:-source1.3 中不支持注释
- python re.compile(?P<name>)
- python re.compile()和findall()
- python 中的 re.compile 函数
- python中遇到的问题
- python中re的使用
- Python正则表达式中的 compile,search,group,groups 函数的简单说明
- Python正则表达式中的 compile,search,group,groups 函数的简单说明
- Python正则表达式中的 compile,search,group,groups 函数的简单说明
- python正则表达式 re (二)compile
- C#学习笔记之字符串和16进制字符串之间的转换
- MVC命名
- 如何在简历中编写Spark大数据项目经验
- 习题1 第一个程序
- 实心菱形
- Python中re.compile遇到only supports 100 named groups的问题
- 空心菱形
- Leet常用数据结构【LeetCode】
- 最大公约数,最小公倍数
- springboot与jdbc
- 切换
- 数字反转(升级版)
- 解释器模式 详解
- 下拉列表小例子