Re: Read binary file and dump data in

2009-01-14 Thread Santiago Romero
> If you are reading arbitrary bytes then it will likely not always "look" > like integers. What you probably meant is: > > for i in data: >    print "%d, " % ord(i) That's it! :-) Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list

Re: Read binary file and dump data in

2009-01-13 Thread Chris Rebert
On Tue, Jan 13, 2009 at 12:02 PM, Santiago Romero wrote: > > Hi. > > Until now, all my python programs worked with text files. But now I'm > porting an small old C program I wrote lot of years ago to python and > I'm having problems with datatypes (I think). > > some C code: > > fp = fopen( fi

Re: Read binary file and dump data in

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 12:02 -0800, Santiago Romero wrote: > Hi. > > Until now, all my python programs worked with text files. But now I'm > porting an small old C program I wrote lot of years ago to python and > I'm having problems with datatypes (I think). > > some C code: > > fp = fopen( fi

Read binary file and dump data in

2009-01-13 Thread Santiago Romero
Hi. Until now, all my python programs worked with text files. But now I'm porting an small old C program I wrote lot of years ago to python and I'm having problems with datatypes (I think). some C code: fp = fopen( file, "rb"); while !feof(fp) { value = fgetc(fp); printf("%d", val