Print a string in binary format

From: neutrino (hanchunhui_at_gmail.com)
Date: 01/21/05


Date: 20 Jan 2005 16:53:22 -0800

Greetings to the Python gurus,

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.
Thanks a lot.



Relevant Pages

  • Re: Spartan3E Slave Serial Daisy chain
    ... I'm attempting to configure the 3 devices from an Atmel AVR reading the ... Is this the correct way to generate a binary file from 3 separate ... always used the raw hex format to create a file that is about twice ... and use the output for embedded programming. ...
    (comp.arch.fpga)
  • Re: Mutli Type in same file
    ... then you can use a Random file and just offset ... by the number of records the header took up. ... header out to 1000 bytes and read that in via binary mode. ... using a binary file and your own read and write code is not ...
    (comp.lang.basic.visual.misc)
  • Re: How to read a binary file from the middle of the file
    ... If this is a binary file you do not have a concept of "line" just a raw ... array of bytes. ... Use FileStream to read the file and use FileStream.Seek to positionate the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: File read and writing in binary mode...
    ... according to some formatting agreed/imposed by them. ... Binary files are raw files. ... text file" requires that you convert the binary file to a format ... why would you want to put binary data into a text file? ...
    (comp.lang.python)
  • Re: fread can not read particular data
    ... The binary value 0x1A just happens to be the ASCII value CTRL-Z. ... you have opened a binary file in text mode. ... open the binary file in binary mode. ... darrell at cs dot toronto dot edu ...
    (comp.lang.c)

Loading