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. Advertisements

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:
    417
    aleko
    Feb 25, 2005
  2. Randall Parker
    Replies:
    1
    Views:
    668
    Kevin Spencer
    Oct 28, 2005
  3. Replies:
    8
    Views:
    407
    Alf P. Steinbach
    Jul 28, 2007
  4. Jonathan Gardner

    Asynchronous urllib (urllib+asyncore)?

    Jonathan Gardner, Feb 26, 2008, in forum: Python
    Replies:
    1
    Views:
    707
    Terry Jones
    Feb 27, 2008
  5. Valery Khamenya
    Replies:
    3
    Views:
    983
  6. Chris McDonald
    Replies:
    0
    Views:
    500
    Chris McDonald
    Nov 1, 2010
  7. Robin Wenger
    Replies:
    3
    Views:
    1,506
    Daniele Futtorovic
    Jan 25, 2011
  8. ela
    Replies:
    3
    Views:
    175
    Jürgen Exner
    Dec 8, 2008
Loading...