Better way to isolate string

HMS Surprise john at datavoiceint.com
Fri May 11 12:57:14 EDT 2007


On May 11, 10:45 am, Tim Golden <m... at timgolden.me.uk> wrote:
> HMS Surprise wrote:
> > I suppose a one liner would look better, but I am alway leery of these
> > things 'breaking'.
>
> > t = s.split('">')[-1].split('<')[0]
> > s ='<a href="../active/Group_Detail.php?
> > GroupID=G132153&SvcType=1&AType=V" class="dvLink">G132153</a>'
>
> Only if you're competing in an obscurity competition ;)
>
> If you're really confined to built-ins (ie you can't import
> a single module) then just go with your original solution.
> Why not?
>
> If you can import modules, then you want to look
> at the urlparser and cgi modules, I suspect.
>
> TJG

Thanks for replying Tim. Good point.

jh




More information about the Python-list mailing list