Viewing Binary Data

C

Cuyler

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
 
C

Claudio Grondi

Cuyler said:
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
 
P

Peter Hansen

Cuyler said:
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
 
P

Paul Watson

Cuyler said:
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
 
B

Bengt Richter

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
 
R

Rod Haper

Paul said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top