I'm making a console application, and i want to create a feature where you can create your own command if you feel like it's needed. Here is my code:
I would like to know if there is a way to create a variable with the name of console's current state. (e.g. if console is set to 4, create a variable named 4)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
else : print ( 'Unknown command entered. Would you like to give this command a meaning' ) temporary_console_input = console console = input ( 'Y or N? ' ) creating_new_command_temp_waiting = True while creating_new_command_temp_waiting = = True : if console = = 'y' : # Placeholder else if console = = 'Y' : # Placeholders else if console = = 'n' : # Placeholders else if console = = 'N' : # Placeholders else if console = = 'sys.exit(0)' : print ( 'Shutting down' ) sys.exit( 0 ) else : print ( 'Unknown Option Entered. Please try again.' ) creating_new_command_temp = console logger.info( 'Creating command: "' + console + '"' ) |
Self-taught HTML, CSS, Python, and Java programmer