urlencoding dictionaries

Aahz Maruch aahz at netcom.com
Wed May 31 01:23:51 EDT 2000


In article <Pine.LNX.4.10.10005302350180.30770-100000 at Gloria.CAM.ORG>,
Marc Tardif  <intmktg at Gloria.CAM.ORG> wrote:
>>>> params = {'one': 'First param',
>...           'two': None
>...          }
>>>> print urllib.urlencode(params)
>one=First+param&two=None
>
>Problem is, isn't "None" suppose to be a null object making it absurd to
>output "two=None"? Shouldn't urlencode output "two=" or nothing at all
>even? Is this a potential improvement upon the urllib module or is there a
>way to circumvent this problem I seem to be having?

% python
Python 1.5.2 (#2, Nov 15 1999, 18:26:02)  [GCC 2.7.2] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> print '%s'%None
None

You'll need to use '' instead of None, unfortunately.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Have you coined a word today?  --Aahz



More information about the Python-list mailing list