itoa

Emile van Sebille emile at fenx.com
Tue Mar 14 03:44:36 CET 2000


Stuart,

I recently needed what may be similar to what you're
asking for, and I wrote a small set of functions
that allow for:

>>> print dec(bin(12345)) # signed decimal of binary
12345L
>>> print hta(bin(12345)) # hex of binary
3039
>>> print ath(hta(bin(12345))) # ascii of hex of binary
09
>>> print dec(ath(hta(bin(12345)))) # signed decimal of prior
12345L
>>> print asc(bin(42345)) # ascii (unsigned-decimal) etc...
42345L
>>> print hta(bin(42345))
a569
>>> print ath(hta(bin(42345)))
¥i
>>> print asc(ath(hta(bin(42345))))
42345L

If you're interested, I'll e-mail you the module.

Emile van Sebille
emile at fenx.com
-------------------


----- Original Message -----
From: Stuart Reynolds <S.I.Reynolds at cs.bham.ac.uk>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Monday, March 13, 2000 10:37 AM
Subject: itoa


> Is there an integer to ascii (itoa) function in Python? I need to
> convert integers into various different bases (but to binary, in
> particular). Most languages come provided with an itoa-like function
but
> I can't seem to find one in the Python API.
>
> Stuart
> --
> http://www.python.org/mailman/listinfo/python-list
>






More information about the Python-list mailing list