Re: Print a string in binary format

2005-01-21 Thread Nick Coghlan
Bengt Richter wrote: On Sat, 22 Jan 2005 00:45:19 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: Here's an interesting twiddle, though (there's probably already something along these lines in the cookbook): Looks like you also played with this problem, after Alex posted a request for alternative

Re: Print a string in binary format

2005-01-21 Thread Bengt Richter
On Sat, 22 Jan 2005 00:45:19 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >neutrino wrote: >> 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 str

Re: Print a string in binary format

2005-01-21 Thread Steven Bethard
Stephen Thorne wrote: On Fri, 21 Jan 2005 01:54:34 GMT, Kartic <[EMAIL PROTECTED]> wrote: Aha..I guess I posted too soon. You might want to take a look at this cookbook entry: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/219300 Defines lambdas to convert integer to binary. The one you pr

Re: Print a string in binary format

2005-01-21 Thread Nick Coghlan
neutrino wrote: 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 o

Re: Print a string in binary format

2005-01-20 Thread Paul Rubin
"neutrino" <[EMAIL PROTECTED]> 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 o

Re: Print a string in binary format

2005-01-20 Thread Bengt Richter
On 20 Jan 2005 17:21:42 -0800, "neutrino" <[EMAIL PROTECTED]> wrote: >Mmm, the output format that I want is like: >00011100 > >I tried your code on Cygwin under Windows 2000, and on Linux, but it >prints out ASCII characters. > You can make a 256-length list t

Re: Print a string in binary format

2005-01-20 Thread Stephen Thorne
On Fri, 21 Jan 2005 01:54:34 GMT, Kartic <[EMAIL PROTECTED]> wrote: > neutrino said the following on 1/20/2005 8:21 PM: > > Mmm, the output format that I want is like: > > 00011100 > > > > I tried your code on Cygwin under Windows 2000, and on Linux, but it > > p

Re: Print a string in binary format

2005-01-20 Thread neutrino
Mmm, the output format that I want is like: 00011100 I tried your code on Cygwin under Windows 2000, and on Linux, but it prints out ASCII characters. -- http://mail.python.org/mailman/listinfo/python-list

Re: Print a string in binary format

2005-01-20 Thread Peter Hansen
neutrino wrote: Mmm, the output format that I want is like: 00011100 I tried your code on Cygwin under Windows 2000, and on Linux, but it prints out ASCII characters. Generally speaking, trying to work with binary like that will drive you mad. Most people find t

Re: Print a string in binary format

2005-01-20 Thread Kartic
neutrino said the following on 1/20/2005 8:21 PM: Mmm, the output format that I want is like: 00011100 I tried your code on Cygwin under Windows 2000, and on Linux, but it prints out ASCII characters. Aha..I guess I posted too soon. You might want to take a look

Re: Print a string in binary format

2005-01-20 Thread Kartic
neutrino said the following on 1/20/2005 7:53 PM: 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

Re: Print a string in binary format

2005-01-20 Thread Mark McEahern
neutrino wrote: 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 o

Print a string in binary format

2005-01-20 Thread neutrino
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