Print a string in binary format
Fri Jan 21 01:26:16 EST 2005
"neutrino" <hanchunhui at gmail.com> writes:
> I have a binary file and wish to see the "raw" content of it. So I open
> it in binary mode, and read one byte at a time to a variable, which
> will be of the string type. Now the problem is how to print the binary
> format of that charater to the standard output. It seems a common task
> but I just cannot find the appropriate method from the documentation.
There's not a builtin for it. There was some discussion in the bug
system of adding it to the binascii module. Meanwhile you sort of
have to write actual code.
More information about the Python-list