I need to turn bytes from a file into a string of 1's and 0's,
file = open("Some_File.jpg","rb")
data = file.read()
file.close()
binary = some_function(data)
print(binary)
>>> 0100101000010101001...
I've managed to get something equivalent by converting the bytes into Base64 first, however this makes the size of the string very long. Other questions I have looked at are about turning binary strings into bytes, but I can't find any of the opposite.
This question was marked as a duplicate of another question, however this question is turning a string into binary. If I wanted to do that, I would just convert it into Base64, however it makes it far too long. I need a way to to 'bytes' directly into a string of 1's and 0's