On Wed, March 29, 2006 2:50 pm, Kaushal Shriyan wrote: > Hi > > I am unable to execute the below code, I have put this in test.py file > and made it executable, when I run this I see no output, Please > explain me as what is exactly going on with the below code > > The below code is from http://www.ibiblio.org/obp/thinkCSpy/chap11.htm > > def copyFile(oldFile, newFile): > f1 = open(oldFile, "r") > f2 = open(newFile, "w") > while 1: > text = f1.read(50) > if text == "": > break > f2.write(text) > f1.close() > f2.close() > return
Did you have only the copyFile definition or did you have an invocation as well? You have to call it to work. :) -- -NI _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor