finding contents from string

Peter Otten __peter__ at web.de
Tue Feb 16 12:00:06 CET 2010


danin wrote:

> Hi all,
>         I am looking for particular solution. I am having one string
> say:
> string- "http://maps.google.co.in/maps/ms?
> 
hl=en&ie=UTF8&msa=0&msid=106178526636832397420.00047fb46fa8d02481f09&ll=20.730428,86.456909&spn=2.178194,3.526611&z=8
> "
>           and from this string  i need to extract value
> -20.730428,86.456909. 

Where does the "-" come from?

> These value are dynamic so i cant use filter. 

I don't understand.

> So can anyone please tell me about how to do this.

>>> from urlparse import urlparse, parse_qs
>>> parse_qs(urlparse(string).query)["ll"][0]
'20.730428,86.456909'

Peter



More information about the Python-list mailing list