I'm trying to read a file's contents and convert them into what is actually stored in memory if I write
file = open("filename","br")
binary = "0b"
for i in file.read():
binary += bin(i)[2:]
will binary
equal the actual value stored in memory?
if so, how can I convert this back into a string?
EDIT: I tried
file = open("filename.txt","br")
binary = ""
for i in file.read():
binary += bin(i)[2:]
stored = ""
for bit in binary:
stored += bit
if len(stored) == 7:
print(chr(eval("0b"+stored)), end="")
stored = ""
and it worked fine until it reached a space and then it became weird signs and mixed-up letters.