[Tutor] Python Code

Kaushal Shriyan kaushalshriyan at gmail.com
Wed Mar 29 11:20:34 CEST 2006


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

Thanks in Advance

Regards

Kaushal


More information about the Tutor mailing list