Comment faire un retour automatique au menu dans un menu en temi
xunil2003
Messages postés
765
Date d'inscription
Statut
Membre
Dernière intervention
-
dsy73 Messages postés 9252 Date d'inscription Statut Contributeur Dernière intervention -
dsy73 Messages postés 9252 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
j'ai fait ce menu pour le terminal :
Je voudrais savoir comment faire un retour automatique au menu ?
Merci
j'ai fait ce menu pour le terminal :
#!/usr/bin/python
print (30 * '-')
print (" - M E N U")
print (30 * '-')
print ("1. Sauvegarde")
print ("2. Restauration")
print ("3. Reboot server")
print (30 * '-')
choice = raw_input('Enter votre choix [1-3] : ')
choice = int(choice)
if choice == 1:
print ("Sauvegarde")
elif choice == 2:
print ("Restauration")
elif choice == 3:
print ("Reboot server...")
else: ## default ##
print ("Erreur saissi invalide ")
Je voudrais savoir comment faire un retour automatique au menu ?
Merci
A voir également:
- Comment faire un retour automatique au menu dans un menu en temi
- Menu déroulant excel - Guide
- Canon quick menu - Télécharger - Utilitaires
- Réponse automatique thunderbird - Guide
- Windows 11 menu contextuel classique - Guide
- Windows 11 menu démarrer classique - Guide
3 réponses
Bonjour
Voilà c'est bon, j'ai fait comme ceci :
Merci.
Voilà c'est bon, j'ai fait comme ceci :
#!/usr/local/bin/python
# -*- coding:utf-8 -*-
def un():
print "1 - un"
def deux():
print "2 - deux"
def trois():
print "3 - trois"
def quatre():
print "4 - quatre\n Quitter"
quit()
while True:
print (30 * '-')
print (" M E N U")
print (30 * '-')
print "1) Sauvegarde"
print "2) Restauration"
print "3) Reboot server"
print "4) Quitter"
print (30 * '-')
choix = input('Veuillez indiquer votre choix [1-4] : ')
print choix
if choix == 1:
un()
elif choix == 2:
deux()
elif choix == 3:
trois()
elif choix == 4:
quatre()
else: ## default ##
print ("Erreur saissi invalide ")
Merci.