def confirm(destname): """Ask whether destination name should be overwrited.""" while True: try: return yesno(input("File '{}' already exist. Overwrite? [yn] ".format(destname))) except ValueError: continue
def yesno_type(string): """Interpret argument as a "yes" or a "no". Raise `argparse.ArgumentTypeError` if string cannot be analysed. """ try: return yesno(string) except ValueError as error: raise argparse.ArgumentTypeError(str(error))
def confirm(destname): """Ask whether destination name should be overwrited.""" while True: try: return yesno( input("File '{}' already exist. Overwrite? [yn] ".format( destname))) except ValueError: continue