puzzle about file Object.readlines()

林桦 fjlinhua at gmail.com
Sat Mar 19 09:15:47 EDT 2011


i use python 2.5. os is window 7.
the puzzle is :python don't read the leave text when meet character: chr(26)

the code is:
*  fileObject=open('d:\\temp\\1.txt','w')
    fileObject.write('22222222222222\r\n')
    fileObject.write(chr(26)+'\r\n')
    fileObject.write('33333333333333')
    fileObject.close()
    fileObject=open('d:\\temp\\1.txt','r')
    i=0
    for line in fileObject:
        i+=1
        print str(i)+'******'+line
    fileObject.close()*

the output only print:
* >>>
1******22222222222222*

but can't print next line text:*'33333333333333'' 。who tell me why?
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110319/e8410906/attachment.html>


More information about the Python-list mailing list