seanm.py at gmail.com
Sat Aug 22 00:25:17 CEST 2009
In the book I am using, they give the following function as an
def copyFile(oldFile, newFile):
f1 = open(oldFile, 'r')
f2 = open(newFile, 'w')
text = f1.read(50)
if text == "":
My question is why does this function successfully copy a 200
character file, oldFile, to newFile? The line of code that reads,
= f1.read(50), does not seem to be iterative in any way to me. How is
this fuction succeding in adding each additional set up 50 characters
to the previous set of 50 characters read from oldFile?
How does it even succeed in copying a 25 character file? If oldFile
contains 25 characters, how does the program ever break out of the
'while True:' loop?
I just don't see it.
Again, much thanks to anyone who can clear this up.
More information about the Python-list