Hello!
I have this piece of code, which asks the user to continue with the program even if it may overwrite some folders.
print w.fill('WIP will create Backup, Resized and Watermarked folders to store the original, resized and watermarked pictures. It will overwrite them if they already exists. Are you sure you want to continue (y/n)?')
overwrite = raw_input('> ')
if overwrite == 'y':
#Create a Backup directory
if not os.path.exists('Backup'):
os.mkdir('Backup')
#Create a Resized directory
if not os.path.exists('Resized'):
os.mkdir('Resized')
#Create a marked directory
if not os.path.exists('Watermarked'):
os.mkdir('Watermarked')
elif overwrite == 'n':
print 'Thank you for using WIP'
sys.exit()
else:
print 'This option is not available'
sys.exit()
I would like that the last option, which prints 'This option is not available', goes back to the beginning of this piece of code, asking the user for an input. How can I do this? I have thought of using
continue
, but I have read that it can only be used with the 'if' and 'while' statements.
Cheers!
Dani