number base conversion? (ASCII to Hex)
Fredrik Lundh
effbot at telia.com
Fri May 12 02:25:15 EDT 2000
<chibaA at TinterlogD.Tcom> wrote:
> Alright... I'm still confused (probably because I'm not asking the
> right question). hex(word('1')) requires (I'm assuming) an
> integer/character input - and word[1] provides a string. So it won't
> work.
>>> type('1')
<type 'string'>
> I'm creating a script which outputs a call to another python script
> with arguments. The second program reads in values in CGI format - so
> I have to output all of the arguments in this fashion. Maybe there's
> a mod that already does this (CGI does not - that only goes the other
> way).
we're talking about %xx encoding of reserved URL characters?
urllib.quote might be what you want:
>>> urllib.quote("a+b+c")
'a%2bb%2bc'
docs are here:
http://www.python.org/doc/current/lib/module-urllib.html
</F>
More information about the Python-list
mailing list