How to print a file in binary mode

Felipe Almeida Lessa felipe.lessa at gmail.com
Sun Oct 22 09:58:15 EDT 2006


22 Oct 2006 06:33:50 -0700, Lucas <Luwian at gmail.com>:

> I known how to do it.
> read() return a string. so
> 1) bytes = read(1) #read the file by bit.
> 2) chrString  = ord(bytes) #convert the string to ASCII.
> 3) print numberToBinary(chrString) #convert the ASCII to Binary using
> my function.
> 4) Loop


[numberToBinary(ord(x)) for x in f.read()]    ?

-- 
Felipe.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061022/23814adf/attachment.html>


More information about the Python-list mailing list