Hello.
Is it possible to read the bits (the 0's and 1's) of a string or a file
with Python? What module would I use?
Thanks in advance,
Øyvind
--
This email has been scanned for viruses spam by Decna as - www.decna.no
Denne e-posten er sjekket for virus spam av Decna as - www.decna.no
Øyvind wrote:
Hello.
Is it possible to read the bits (the 0's and 1's) of a string or a file
with Python? What module would I use?
I don't know exactly what you mean by read the bits but you can use
data = open('afile', 'b').read() to get the data into a string
byte1=ord(data[1]) to get a
Øyvind [EMAIL PROTECTED] wrote in message
Is it possible to read the bits (the 0's and 1's) of a string or a file
with Python? What module would I use?
Yes, you can read the bits by reading bytes and applying
bitmasks and bitwise operations.
You can get the bytes using the struct module