I have a problem and I searched a lot and I didn't found an answer.
I read from file as example : "video.mp4" by binary I get as an example : b'\x00\x02\x1a\x00' (binary list) I saved it as string in file : b'\x00\x02\x1a\x00' (string)
I read it again as string : "b'\x00\x02\x1a\x00" (string) I want to convert it again to binary, but no result !!
sometimes I get it like this b"b'\x00\x02\x1a\x00"'
Any answer ??
Oh sorry, here i made simple code because the original is messed up
#!/usr/bin/python
FILE = open("video.mp4", "rb")
FILE2 = open("video", "w")
chunk = FILE.read(8)
FILE2.write(str(chunk))
FILE.close()
FILE2.close()
FILE = open("video", "r")
line = FILE.readline()
print(line)
print(line == str(chunk))
FILE.close()
FILE = open("video_binary", "wb")
FILE.write(line) # Here I want line to convert to binary
FILE.close()
But it same thing