====== Sélection dans une liste de choix ====== Sélectionner une commande à exécuter parmi une liste affichée à l'écran : #!/usr/bin/env python3 import os commands = { '1': "ligne de commande 1", '2': "ligne de commande 2", '3': "ligne de commande 3", } for key in commands: print("%-3s: %s" % (key, commands[key])) choice = input("Commande à exécuter: ") if(commands[choice]): os.system(commands[choice])