[Tutor] urllib

Jojo Mwebaze jojo.mwebaze at gmail.com
Mon Dec 7 08:38:24 CET 2009


hello Tutor,

I need help on something very small...

i am using urllib to write a query and what i want returned is
'FHI=128%2C128&FLO=1%2C1'

i have tried the statement below and i have failed to get the above..

x1,y1,x2,y2 = 1,1,128,128

query = urllib.urlencode({'FHI':'x2,y2,', 'FLO':'x1,y1'})

when that failed, i tried to use

query ='FHI=%(x2)d%2C%(y2)d&FLO=%(x1)d%2C%(y1)d' % vars()

returned an error "TypeError: not enough arguments for format string"

i also tied

query ='FHI=%d\%2C%d&FLO=%d\%2C%d' %(x1,x2,y1,y2)

i got the error ValueError: unsupported format character 'C' (0x43) at index
8

Where could i be going wrong!

Johnson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091207/ade68747/attachment-0001.htm>


More information about the Tutor mailing list