We can convert any digital file into binary file.
I have a text file of 1MB,
I want to convert it to a binary string and see the output as a binary number and the vice versa,
in other words, if I have binary number, I want to convert it to a text file.
How could I do that in Python? is there a standard way to do this?
Now in this forum there are some posts (1,2,3, 4 ) on this but none of them answer properly to my question.
See https://docs.python.org/3/library/codecs.html#standard-encodings for a list of standard string encodings, because the conversion depends on the encoding.
These functions will help to convert between bytes/ints and strings, defaulting to UTF-8.
The example provided uses the Hangul character "한" in UTF-8.