[Tutor] write a file

APQ LE apqle75 at hotmail.com
Wed Mar 24 14:13:11 EST 2004


I'm trying to open a file, read its content and write its content to a new 
file.  Pretty much like copying a file.  Here is what I have

========
in = open ("a.txt", "r")
out = open ("b.txt", "w")
for line in in.readlines()
   out.write(line)

in.close()
out.close()

==========
However, the output isn't as expected.  There is additional empty line comes 
after every existing line.  So, the output file is bigger than the original 
file.

~Megan

_________________________________________________________________
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://toolbar.msn.com/go/onm00200413ave/direct/01/




More information about the Tutor mailing list