可以用?P<name>的方法给正则匹配的部分命名。

例:要将<字母,数字>的部分命名为test

x = "abc <haha,123> test @@"
pattern = "(?P<test>\<\w+,\d+\>)"
m = re.search(pattern, x)
r = m.group("test")
print r

输出:

<haha,123>

最新文章

  1. Pairwise Sum and Divide 51nod
  2. spring mvc &lt;mvc:annotation-driven/&gt; 自定义拦截器不走
  3. 即时反应的input和propertychange方法
  4. ie6-ie8中不支持opacity透明度的解决方法
  5. 提供RESTful服务
  6. tomcat域名访问配置
  7. HDU 4417 - Super Mario ( 划分树+二分 / 树状数组+离线处理+离散化)
  8. 一个简单的flask程序
  9. 《微信小程序七日谈》- 第五天:你可能要在登录功能上花费大力气
  10. html中p标签行间距的问题
  11. Winform 中 dataGridView 导出到Excel中的方法总结
  12. Confluence 6 修改日志文件的大小数量和级别
  13. 案例学python——案例一:抓图
  14. ubuntu下的网速限制软件wondershaper (2011-09-18 00:00:00)转载▼
  15. https://stackoverflow.com/questions/40949967/running-storm-from-intellij-nimbus-error
  16. iOS之Block总结以及内存管理
  17. JavaScript:正则表达式 应用
  18. Linux进程地址空间和虚拟内存
  19. 我对于C#的想法
  20. oracle 查看表空间以及剩余量

热门文章

  1. Python中文显示问题&amp;数据库连接传参
  2. Python 转路由之uplink
  3. 如何发布自己的 jar 包到 maven 中央仓库(待更新...)
  4. WSGI、uwsgi和uWSGI
  5. JSP表达式语音EF--2
  6. nginx 开启静态 gzip 配合 Vue 构建
  7. tensorflow开发基本步骤
  8. ansible 常见指令表
  9. &lt;TCP/IP&gt;链路层小结
  10. tomcat和springboot访问日志及分析