#! /usr/local/bin/python3 '''hello.py: le programme 'Hello world' bien connu. Usage: hello.py [-h] [--help] [nom_de_personne]+ ''' import sys, getopt def usage(): 'Print usage doc and exit.' print (__doc__) sys.exit() def hello(arg): print ('Hello %s!' % arg) if __name__ == '__main__': try: optlist, arglist = getopt.getopt(sys.argv[1:], 'h', ['help']) except: usage() for option in optlist: if option[0] in ['-h', '--help']: usage() if arglist: for arg in arglist: hello(arg) else: usage()