I have the script where first the user is given a menu and then based on menu options the script runs.
def menu():
descriptions = ('SetupFeeDescr', 'OveruseFeeDescr', 'RecurrFeeDescr', 'CancellationFeeDescr')
planIds = input('Specify Plan Id. Multiple Ids seperated by comma: ')
print('\n Which description would you like to update? \n')
for i,j in enumerate(descriptions):
print(i+1,"-",j)
print("Q - Quit")
user_input = input('Enter your selection: ')
if user_input == '1':
descr = descriptions[0]
if user_input == '2':
descr = descriptions[1]
if user_input == '3':
descr = descriptions[2]
if user_input == '4':
descr = descriptions[3]
if user_input.lower() == 'q':
return
return(descr, planIds)
How do I make my 'main' loop forever until 'q' is given via menu?
if __name__ == '__main__':
prefixes = get_prefix()
descr, planIds = menu()
data, old = get_plan_rates(planIds, prefixes, descr)
replace_content(data, old, descr)
I don't think it's a duplicate of that other thread because I'm trying to loop over a definition indefinetly, and the script executes 4 defs.