[Tutor] Python Code
Noufal Ibrahim
noufal at nibrahim.net.in
Wed Mar 29 11:45:33 CEST 2006
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
More information about the Tutor
mailing list