1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#!/usr/bin/python # Version 1 ## Show menu ## print (30 * '-') print (" M A I N - M E N U") print (30 * '-') print ("1. Backup") print ("2. User management") print ("3. Reboot the server") print (30 * '-') ## Get input ### choice = raw_input('Enter your choice [1-3] : ') ### Convert string to int type ## choice = int(choice) ### Take action as per selected menu-option ### if choice == 1: print ("Starting backup...") elif choice == 2: print ("Starting user management...") elif choice == 3: print ("Rebooting the server...") else: ## default ## print ("Invalid number. Try again...") |
