Strange thing: file.close did not show error but work wrong

wqhdebian wqhdebian at 263.net
Wed Nov 21 21:22:34 EST 2001


f='d:\\d.txt'
fdw='d:\\matlabdata.txt'
import string
fd=open(f,'r')
fdw=open(fdw,'w+')
b=fd.readlines()
num=len(b)
print 'num='
print num
#print b
print type(b)
#a=string.split(b,'  ')
print len(b)
#for i in b[:]:
 # print i
fdw.write('i')
fd.close###########################
fdw.close#########################  When I use like this ,there is no
warning and
##############any error message,but the file do not have been
writen.After I change back to fdw.close(),Then it work well.

    I use python2.1.1 under windows



More information about the Python-list mailing list