group和groups是两个不同的函数。
一般,m.group(N) 返回第N组括号匹配的字符。
而m.group() == m.group(0) == 所有匹配的字符,与括号无关,这个是API规定的。
m.groups() 返回所有括号匹配的字符,以tuple格式。
m.groups() == (m.group(0), m.group(1), ...)
相关文章
- Python中模块及和requests的使用区别
- 第11.24节 Python 中re模块的其他函数
- 第11.18节 Python 中re模块的匹配对象
- 第11.22节 Python 中re模块的字符串分割器:split函数
- Python 中 typing 模块和类型注解的使用
- python中的pwd和grp内置模块
- 【Python教程】 re 模块中findall 函数返回值展现方式的用法详解
- 【python】re模块的 findall 和 finditer 函数用法
- Python中Pickle模块的dump方法和load方法
- 【原创】如何治疗使用python中re模块group、groups与findall分组匹配后产生的“眩晕反应”