I am very much new to Python and basically want anything other than d or o to rerun the question? Any help?
Myfile = raw_input( '''Specify filename (o) or use default chain (d)? ''')
if Myfile == 'd':
print 'default choosen '
Myfile = 'M:/test/testchains_a.csv'
if Myfile == 'o':
print 'own file choosen '
Myfile = raw_input('Enter absolute path to the .csv file:')
else:
print 'successful'
You can do this the way
squiguysuggested, but it might be more readable to put the whole thing into a loop, so you don’t have to repeat the same checks twice:This will loop forever, until it hits a
break—in other words, until they select'd'or'o'.