Skip to content

Instantly share code, notes, and snippets.

@taljaards
Created February 20, 2018 14:40
Show Gist options
  • Save taljaards/b3cc0b13e1d6bdd13046388d34f044a6 to your computer and use it in GitHub Desktop.
Save taljaards/b3cc0b13e1d6bdd13046388d34f044a6 to your computer and use it in GitHub Desktop.
Two files: 1 - Code to get user input for the rest of the main script, 2 - console output. Why is the console output "slow"?
default_flag = 'y'
def get_input(prompt, default_value, default_flag_=default_flag, print_=True):
print()
answer = input(prompt)
if answer == default_flag_:
answer = default_value
if print_:
logger.info(answer)
return answer
print('-------------------------------------------------------------------------')
print('All input paths need to be entered now. Enter {} to use the default path.'.format(default_flag))
print('-------------------------------------------------------------------------')
batching_data_path = get_input('Batching file: ', 'Batching Data_2016_M1-M4.xlsx')
customisable_input_path = get_input('Customizable Excel input sheet: ', 'Inputs.xlsx')
production_data_path = get_input('Production data (modelling sheet): ', 'modelling_d01.xlsx')
kpi_data_path = get_input('KPI sheet: ', 'KPI data sheet.xlsx')
print('-------------------------------------------------------------------------')
print()
-------------------------------------------------------------------------
All input paths need to be entered now. Enter y to use the default path.
-------------------------------------------------------------------------
Batching file: y
[INFO] Batching Data_2016_M1-M4.xlsx
Customizable Excel input sheet: y
[INFO] Inputs.xlsx
Production data (modelling sheet): y
[INFO] modelling_d01.xlsx
KPI sheet: y
-------------------------------------------------------------------------
[INFO] KPI data sheet.xlsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment