base conversion

Allan M. Wind allanwind at mediaone.net
Fri Oct 6 16:15:19 EDT 2000


On 2000-10-06 15:38:13, Joel Lucsy wrote:

> Yes, but standard compression routines like zlib or lzo don't work well on
> short sequences. I'd rather treat the string as a decimal rather than a
> string and simply (well, it seems simple) convert the base. Perhaps a
> different method would work, but my brain just doesn't want to descramble
> how to do it.

I don't know what your design requirements are, but you could convert the number to a bit array, then encode that in any 2^n by defining an encoding.  If your data can be binary (and contain \x00) you could just write every 8 bit as a char.


/Allan
-- 
Allan M. Wind			email: allanwind at mediaone.net
P.O. Box 2022			finger: awind at digit-safe.dyndns.org (GPG/PGP)
Woburn, MA 01888-0022		icq: 44214251
USA




More information about the Python-list mailing list