Viewing Binary Data

Discussion in 'Python' started by Cuyler, Jan 6, 2006.

  1. Cuyler

    Cuyler Guest

    Hello,

    I would like to display a file in its binary form (1s and 0s), but I'm
    having no luck... Any thoughts would be most appreciated.

    Cheers!

    Cuyler
     
    Cuyler, Jan 6, 2006
    #1
    1. Advertising

  2. Cuyler

    Guest

    , Jan 7, 2006
    #2
    1. Advertising

  3. Cuyler wrote:
    > Hello,
    >
    > I would like to display a file in its binary form (1s and 0s), but I'm
    > having no luck... Any thoughts would be most appreciated.
    >
    > Cheers!
    >
    > Cuyler
    >

    You may consider to check out the latest by me started thread in this
    newsgroup with the subject: "Does Python allow access to some of the
    implementation details?", which surprizingly deals mainly with getting
    bits out of strings and integers and provides appropriate code.

    Claudio
     
    Claudio Grondi, Jan 8, 2006
    #3
  4. Cuyler

    Peter Hansen Guest

    Cuyler wrote:
    > I would like to display a file in its binary form (1s and 0s), but I'm
    > having no luck... Any thoughts would be most appreciated.


    I'm sure the list archives (visible via Google Groups and other means)
    has answers to similar questions in the past. Also the online Python
    CookBook probably has at least one recipe that would help. Have you
    tried searching online at all?

    -Peter
     
    Peter Hansen, Jan 8, 2006
    #4
  5. Cuyler

    Paul Watson Guest

    Cuyler wrote:
    > I would like to display a file in its binary form (1s and 0s), but I'm
    > having no luck... Any thoughts would be most appreciated.


    If you are on a UNIX system, or on Windows with Cygwin, you can use the
    'od' command to dump a file in hex or octal.

    man od
    od -Ax -tx1
     
    Paul Watson, Jan 8, 2006
    #5
  6. On 6 Jan 2006 09:15:50 -0800, "Cuyler" <> wrote:

    >Hello,
    >
    >I would like to display a file in its binary form (1s and 0s), but I'm
    >having no luck... Any thoughts would be most appreciated.
    >

    What have you tried? "having no luck" doesn't tell us much, although it is
    a phrase previously seen in use ;-/
    Is this homework?

    If the first character were 'C' what order would you like to see the bits?
    (e.e., 1000011 (big-endian l-r) vs 1100001 (little-endian l-r)
    Do you want to convert the whole file like a hex dump, except binary?
    Want to give a clue as to output format? Gapped? Ascii at the right?
    Bit numbers or hex byte offsets at the left?
    Do you need a one-liner solution?

    Regards,
    Bengt Richter
     
    Bengt Richter, Jan 8, 2006
    #6
  7. Cuyler

    Rod Haper Guest

    Paul Watson wrote:
    > Cuyler wrote:
    >
    >> I would like to display a file in its binary form (1s and 0s), but I'm
    >> having no luck... Any thoughts would be most appreciated.

    >
    >
    > If you are on a UNIX system, or on Windows with Cygwin, you can use the
    > 'od' command to dump a file in hex or octal.
    >
    > man od
    > od -Ax -tx1



    And if you're on a Linux system and have KDE loaded, use the KHexEdit
    utility. KHexEdit can display the file in hexadecimal, decimal, octal,
    binary or text format, swap endians, search, filter, etc. It's a very
    sweet utility.
     
    Rod Haper, Jan 8, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ricardo Magalhaes

    Viewing Paradox Data Without Correct Accentuation

    Ricardo Magalhaes, Apr 14, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    374
    Ricardo Magalhaes
    Apr 14, 2005
  2. suddy72
    Replies:
    0
    Views:
    346
    suddy72
    Sep 24, 2007
  3. Joshua J. Kugler
    Replies:
    3
    Views:
    743
  4. =?ISO-8859-1?Q?Arint=E9?=

    XmlDataSource and viewing data

    =?ISO-8859-1?Q?Arint=E9?=, Oct 22, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    338
    Arinté
    Oct 23, 2007
  5. Mike Collier
    Replies:
    2
    Views:
    136
    Mike Collier
    Jan 20, 2004
Loading...

Share This Page