Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Viewing Binary Data

Reply
Thread Tools

Viewing Binary Data

 
 
Cuyler
Guest
Posts: n/a
 
      01-06-2006
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

 
Reply With Quote
 
 
 
 
richmoore44@gmail.com
Guest
Posts: n/a
 
      01-07-2006
This recipe is a good place to start:

http://aspn.activestate.com/ASPN/Coo.../Recipe/440528

Cheers

Rich.

 
Reply With Quote
 
 
 
 
Claudio Grondi
Guest
Posts: n/a
 
      01-08-2006
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
 
Reply With Quote
 
Peter Hansen
Guest
Posts: n/a
 
      01-08-2006
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

 
Reply With Quote
 
Paul Watson
Guest
Posts: n/a
 
      01-08-2006
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
 
Reply With Quote
 
Bengt Richter
Guest
Posts: n/a
 
      01-08-2006
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
 
Reply With Quote
 
Rod Haper
Guest
Posts: n/a
 
      01-08-2006
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(8-bit binary to two digit bcd) or (8-bit binary to two digit seven segment) Fangs VHDL 3 10-26-2008 06:41 AM
writing binary file (ios::binary) Ron Eggler C++ 9 04-28-2008 08:20 AM
A 64-bit binary returning a value to a 32-bit binary? spammenotplui31@yahoo.ca C Programming 12 04-08-2007 07:02 AM
PC Viewing vs DVD Player Viewing - MP3 play very fast Ray Donzdorf Computer Support 0 12-11-2004 01:07 PM
Re: ostreams, ios::binary, endian, mixed binary-ascii Marc Schellens C++ 8 07-15-2003 12:27 PM



Advertisments