dongdong wrote:
> for example:
>  re.sub('<a( [^>]+)+\s?>[^<^>]*</a>','',' asd ga<a target="_blank"
> href="http://www.sine.com"; class="wordstyle"> asdgasdghae rha</a>')
> 
> I wish to get the return value "asd ga asdgasdghae rha",how do do?
> I have a impression on "%" and "{number}",but forgot how to use them.
> 
Use a group to capture the text between <a> and </a>:

In [10]: re.sub('<a( [^>]+)+\s?>([^<^>]*)</a>',r'\2',' asd ga<a 
target="_blank" href="http://www.sine.com"; class="wordstyle"> 
asdgasdghae rha</a>')
Out[10]: ' asd ga asdgasdghae rha'

Kent
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to