chr(26) => file reading bug

Michal Bozon bozon at natur.cuni.cz
Tue Mar 28 11:47:10 EST 2000


When it is opened a file containing a char chr(26) (i.e. chr(0x1A)), it is
read only until this char.
e.g.:
>>> s = 'abcd'+chr(26)+'efgh'
>>> fn = 'c:/test.dat'
>>> f = open(fn, 'w')
>>> f.write(s)
>>> f.close()
>>> f = open(fn, 'r')
>>> t = f.readlines()
>>> f.close()
>>> t
['abcd']

(Maybe not exactly so)

How can it be fixed?

I use Python 1.5.2 on Win98


Thanks,
Michal Bozon
Fac.Sci., Charles Univ., Prague, Czech. Rep
- - - - -
bozon at natur.cuni.cz
http://www.natur.cuni.cz/~bozon




More information about the Python-list mailing list