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:
"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
I've been reading 'Core Python Programming (2nd
Edition)'. I have been given the following script:
#!/usr/bin/env 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: