[Tutor] urlparse question
Lance E Sloan
lsloan@umich.edu
Mon, 26 Aug 2002 17:32:44 -0400
--On Monday, August 26, 2002 3:20 PM -0400 Blake Winton <bwinton@latte.ca>
wrote:
> * Danny Yoo <dyoo@hkn.eecs.berkeley.edu> [020826 14:05]:
>###
>>>> query_string =
> "hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+travel+cape+town"
>>>> import cgi
>>>> dict = cgi.parse_qs(query_string)
>>>> dict
> {'hl': ['en'], 'ie': ['UTF-8'], 'oe': ['utf-8'],
> 'q': ['south africa travel cape town']}
>###
>
> You might want to notice that it's completely lost the "lr=" part
> of the query string. If that's important to you, you may need to
> reinvent the wheel.
Hmm... That's a pity. I think it would be more useful if it set
dict['lr'] = None or [].
--
Lance E Sloan
Web Services, Univ. of Michigan: Full-service Web and database design,
development, and hosting. Specializing in Python & Perl CGIs.
http://websvcs.itd.umich.edu/ - "Putting U on the Web"