码迷,mamicode.com
首页 > 编程语言 > 详细

python正则表达式中含有变量的写法

时间:2018-05-27 10:42:36      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:bsp   正则表达   abc   ext   %s   text   findall   表达式   举例   

使用格式化字符串的方式实现
举例:
re.findall("(this,%s,‘(.*?)‘"%str(i),"abcd(this,1,‘123123)‘)
这里i为变量
 

python正则表达式中含有变量的写法

标签:bsp   正则表达   abc   ext   %s   text   findall   表达式   举例   

原文地址:https://www.cnblogs.com/VseYoung/p/9095032.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!