I am new to python. Here is what I am struggling to implement. I have a very long bit string "1010101010101011111010101010111100001101010101011 ... ". I want to write this as bits and create a binary file using python. (Later I want disassemble this using IDA, this is not important for this question).
Is there any way I can write to a file at bit level (as binary)? Or do I have to convert it to bytes first and then write byte by byte? What is the best approach.