[Tutor] reading file contenent 032 octal value
Remco Gerlich
scarblac@pino.selwerd.nl
Wed, 23 Aug 2000 16:33:09 +0200
On Wed, Aug 23, 2000 at 03:49:07PM +0200, Gianmarco Baronio wrote:
> Hello everybody,
>
> I'm working in Windows :-(
>
> I've to read the content of a file that includes the octal value 032 in
> some position; to generate similar file i do:
>
> >>> somefile=open("c:\\pippo.txt",'w')
> >>> somefile.write("some text \032 rest of file")
> >>> somefile.close()
>
> then, I try to read the content of pippo.txt and print it:
>
> >>> somefile=open("c:\\pippo.txt",'r')
> >>> content=somefile.read()
> >>> print content
> some text
>
> why does it stop before EOF?
It doesn't, 032 *is* EOF ;)
Probably there won't be a problem if you open it as binary, try
open("c:\\pippo.txt","rb").
--
Remco Gerlich, scarblac@pino.selwerd.nl