Simplest terminal menu - Python

Here you can find a start up code for running your python project. 

Import the necessary code at the beginning and modify the options in the options dictionary.

import time

# Import here the main part of your code
from My_script import Script

def user_data():
options = {
0: "option 0",
1: "option 1",
2: "option 2"
}
# DISPLAY MENU WITH OPTIONS
while 1:
print("\nSelect and option")
for option in options.items():
print(option)
selectedOption = input("Option to use: ")
if selectedOption.isdigit():
selectedOption = int(selectedOption)
if selectedOption not in options:
print("Error, not a valid option")
else:
break
else:
print("Error, choose the option digit")

# READ A FILENAME
while 1:
file_name = input("Write the file name")
try:
with open(file_name) as f:
# File opened successfully
file = f
break
except FileNotFoundError:
print("Error, couldn't open the file")

return file, options[selectedOption]

# Beginning of the script
print("[ # PROGRAM_NAME # ]")
print("Init program...")
file, option = user_data()
start = time.time()
print("Starting the program...")
Script.main(file, option)
print("Total time:", round(time.time() - start, 3), "seconds.")