[Tutor] need to use # sign

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Wed, 14 Aug 2002 14:19:41 -0700 (PDT)


On Wed, 14 Aug 2002, Danny Yoo wrote:

> If the url contains spaces, we can use the quoteplus() function instead:
                                             ^^^^^^^^^

Doh.  I meant to write "urllib.quote_plus()".  My apologies!



This being said, the urllib module also has a nice function called
urlencode() that may be useful for you:

###
>>> urllib.urlencode( [('name', 'dyoo'),
...                   ('mailing_list', 'tutor@python.org')] )
'name=dyoo&mailing_list=tutor%40python.org'
###

so you may be able to avoid quoting every single cgi parameter manually,
and instead use urllib.urlencode() to do it all at once.


For more information about these functions, you can take a look at:

    http://www.python.org/doc/lib/module-urllib.html


You're always welcome to ask more questions on Tutor.  Best of wishes to
you!