Newbie - converting binary data to ASCII text ?

Cyr cd.cd at wanadoo.fr
Sat Oct 13 09:10:09 EDT 2001


thanks for the answer though it doesn't resolve my problem. I think I'll try
something else ;)

regards

Cyril


"Steve Holden" <sholden at holdenweb.com> wrote in message
news:diUx7.37596$I83.623844 at atlpnn01.usenetserver.com...
> "Cyr" <cd.cd at wanadoo.fr> wrote in message news:9q92g4$6hd$1 at wanadoo.fr...
> > hello,
> >
> > I'm completely new to python and I've got problem reading binary data
> file.
> > When I read a file with read(), the binary data aren't converted. In
fact,
> > I'd like to know if there's a method for converting a file object (or a
> > string) from binary to the equivalent ASCII text. The data aren't
written
> in
> > a particular format. Fortran doesn't have any problem with theese files
> >
> Unfortunately, Python offers much greater flexibility than Python in data
> handling, and correspondingly more chances to shoot yourself in the foot.
> I'm assuming it's *convenient* to have these data in binary form,
otherwise
> you could always write  a Fortran program to convert them into something
> Python finds easier to deal with ...
>
> I also presume it was written with FORMAT statements (sheesh, does Fortran
> even USE those now, showing my age I'm afraid). Python can read a
particular
> number of bytes if you give read() a numeric argument, but if you don't it
> just tries to gobble the whole file in a oner.
>
> Otherwise you may have to look at the struct module, and that's too tricky
> for a beginner.
>
> regards
>  Steve
> --
> http://www.holdenweb.com/
>
>
> > PS : I'm working on an SGI Irix operating system
> >
> >
>
>





More information about the Python-list mailing list