Urllib.encode() - How does it Treat a List?

Discussion in 'Python' started by =?ISO-8859-1?Q?Gregory_Pi=F1ero?=, Jul 28, 2006.

  1. Hi Wise Python Folk,

    Here's my code:
    >>> p={'type':'bar','title':'Gregs Chart 1','values':[1,2,3],'labels':[1,2,3]}
    >>> urllib.urlencode(p)

    'values=%5B1%2C+2%2C+3%5D&labels=%5B1%2C+2%2C+3%5D&type=bar&title=Gregs+Chart+1'

    Now I just can't figure out what it's giving me for say values? What
    is that stuff? What I want is to create a url and pass it a list of
    values, ie so that in the script accepting these parameters I can do:

    form = cgi.FieldStorage()
    values=form.getlist('value')

    and values will equal a list with 1,2, 3 or at least '1', '2', '3'

    Much thanks in advance!

    --
    Gregory PiƱero
    Chief Innovation Officer
    Blended Technologies
    (www.blendedtechnologies.com)
     
    =?ISO-8859-1?Q?Gregory_Pi=F1ero?=, Jul 28, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. aleko
    Replies:
    0
    Views:
    323
    aleko
    Feb 25, 2005
  2. Jonathan Gardner

    Asynchronous urllib (urllib+asyncore)?

    Jonathan Gardner, Feb 26, 2008, in forum: Python
    Replies:
    1
    Views:
    473
    Terry Jones
    Feb 27, 2008
  3. Valery Khamenya
    Replies:
    3
    Views:
    716
  4. Jerry Hill
    Replies:
    0
    Views:
    485
    Jerry Hill
    Oct 4, 2008
  5. Chris McDonald
    Replies:
    0
    Views:
    293
    Chris McDonald
    Nov 1, 2010
Loading...

Share This Page