number base conversion? (ASCII to Hex)

Fredrik Lundh effbot at
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")

docs are here:


More information about the Python-list mailing list