result = raw_input("Enter results file: ")
while True:
try:
result = get_marks_from_file(result)
break
except IOError:
print 'Please supply correct file. '
Above is the raw_input function that I am using to bring a file. When I put correct file name, it works well. But when I put something else such as 'asdsada', the sentence 'please supply correct file. ' is printed and it doesn’t stop. Is there any method for just one printing and return to the question?
Any advices or helps would be appreciated.
Move the
raw_inputinside your loop: