Working with bytes.

Piet van Oostrum piet at cs.uu.nl
Sun Apr 4 11:43:48 EDT 2004


>>>>> anton at vredegoor.doge.nl (Anton Vredegoor) (AV) wrote:

AV> "Adam T. Gautier" <adam_gautier at yahoo.com> wrote:
>> I came up with a solution using the binascii module's hexlify method.

AV> That is the most obvious method, I think. However, the code below
AV> stores 7 bits per byte and still remains ascii-compliant (the
AV> binascii.hexlify method stores 4 bits per byte).
....
AV> sample output:

AV>  Ÿæ‰®ÑëÍ¡¾÷ÁóÆú½Þ·ú˂זðÚ¿‹ˆ²ªÅíž›¾Ÿ£•Í£¬ô²ŸÕØ

Which includes quite a few NON-ASCII characters. 
So what is ASCII-compliant about it?
You can't store 7 bits per byte and still be ASCII-compliant. At least if
you don't want to include control characters.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl



More information about the Python-list mailing list