file object, details of modes and some issues.

simon place simon_place at whsmithnet.co.uk
Thu Sep 4 18:35:11 EDT 2003


could someone confirm ( or otherwise ) this  bug.

manual says file.truncate leave the pointer unmoved, well it doesn't, and left 
me with a bug in a program that took a bit of finding.


 >>> f=file('test.dat','rb+')
 >>> f.write('1234567890')
 >>> f.close()
 >>> f=file('test.dat','rb+')
 >>> f.read(5)
'12345'
 >>> f.tell()
5L
 >>> f.truncate()
 >>> f.tell()
10L
 >>>

( PythonWin 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on
win32. )





More information about the Python-list mailing list