Re: [Tutor] replacing while loop

2007-09-10 Thread Arvind Deshpande
Is this what you are looking for? #!/usr/bin/python 'makeTextFile.py -- create text file' import os # get filename #while True: # fname = raw_input('Enter file name: ') # if os.path.exists(fname): # print"*** ERROR: '%s' already exists" % fname # else: # break while True:

Re: [Tutor] replacing while loop

2007-09-08 Thread Alan Gauld
"Christopher Spears" <[EMAIL PROTECTED]> wrote > I have been asked to replace this while loop with a > try and except clause: > > while True: >fname = raw_input('Enter file name: ') >if os.path.exists(fname): >print"*** ERROR: '%s' already exists" % fname >else: >brea