python re.findall()使用2个模型查找返回包含tuple的list

怎样用re.findall()来对字符串分组呢?在stackoverflow上找到了答案http://stackoverflow.com/questions/6018340/capturing-group-with-findall

举个栗子:

>>> re.findall('abc(de)fg(123)', 'abcdefg123 and again abcdefg123')
[('de', '123'), ('de', '123')]

这样得到了结果,接着怎样在这个list中迭代呢?lz写了个栗子:
#coding:utf-8
import re

line = '我是图片'
listtup = re.findall(r'(.*?)

结果是:

 /files/attachments/00138729035993893cc9f9690e042848b0f7e1816815a36000/0

我是图片




你可能感兴趣的:(python re.findall()使用2个模型查找返回包含tuple的list)