Python does not allow a variable named "pass"

Duncan Booth duncan.booth at invalid.invalid
Sun Apr 11 09:47:35 EDT 2010


BJ Swope <bigblueswope at gmail.com> wrote:

> Other than asking the website owner to change the name of the field
> how can I go about passing that field in the form post?
> 
> dev:~$ python
> Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
> [GCC 4.3.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import urllib
>>>> params = urllib.urlencode(dict(past='foo'))
>>>> params = urllib.urlencode(dict(passs='foo'))
>>>> params = urllib.urlencode(dict(pass='foo'))
>   File "<stdin>", line 1
>     params = urllib.urlencode(dict(pass='foo'))
>                                       ^
> SyntaxError: invalid syntax
> 
> 
Create your dictionary without using keyword arguments:

  fields = {'pass':'foo'}
  params = urllib.urlencode(fields)




More information about the Python-list mailing list