The following script shows how the user can be prompted for an answer.
#!/usr/bin/env python import string import sys # # # def yesno( prompt): sys.stdout.write( prompt) sys.stdout.flush() answer = sys.stdin.readline().upper().strip() if answer == 'Y' or answer == 'YES': return 1 else: return 0 if not yesno( "Do really want it"): # # nothing is executed # return execute_critical_code()