I have a script which has multiple raw_input statements. I would like to add the ability to enter \'undo\' and allow the user to go back and re-enter the last raw_input value.
looks like you coded in a wrong way, an input raw cannot be your point ... maybe you should create an unique raw input and keep the entry into an array
ok....now u post a code example i got it...my suggestion:
import sys
def do(prompt, step):
if 'u' in prompt:
step = step-1
else:
step = step+1
if step>1:
print('Please enter x for x \nPlease enter y for y \nPlease enter c to cancel \nPlease enter u to go back to previous question: ')
else:
print('Please enter x for x \nPlease enter y for y \nPlease enter c to cancel: ')
return step
step = 0
prompt = ""
while prompt != 'c':
step = do(prompt, step)
prompt = raw_input().lower()