Urllib.urlencode question?

Sean Berry sean_berry at cox.net
Wed May 12 00:47:18 EDT 2004


I have two lists... one like the following,

list1 ... ['userid', 'username', 'email']

and the other like this,

list2 ... [['sean', 'Sean Berry', 'sean_berry at cox.net'], ['pam', 'Pam Ward',
'pam_ward at cox.net']]

Both lists are much more extensive, the first being a list of about 10
strings, and the second being a list of 20 lists each containing the values
corresponding to the first lists 10 strings.  But, in order to simplify an
explanation I will use the previously described lists for my question.


I am going to pass this info to Flash in a url encoded string.  I can do
this by parsing through the lists in list2 and appending a string to another
global string, then print this final string.  But I run into problems
because the characters like '@', ' ', and '*' are not encoded.  I have been
experimenting with urllib.urlencode and zipping the two lists together.  But
the desired result will be in the form

n=2&userid0=sean&username0=Sean%20Berry&email0=sean_berry%40cox.net&userid1=
pam&username1=Pam%20Ward&email1=pam_ward%40cox.net

How can achieve adding the numbers to the end of the variable names so that
they can be used by Flash's loadVars function.


Thanks for the help.






More information about the Python-list mailing list