Yeah, just add 1 to it. When printing just do index+1 and when inputting the user's choice, subtract 1 and use it as the array index.
Sent from my iPhone On Sep 10, 2010, at 4:36 PM, Rance Hall <ran...@gmail.com> wrote: > I'm using the following function style I found on the net to create > menus for a command line python script: > > def mainmenu(): > # the main menu > todolist() > mainmenuoptions = ['Clients','Jobs','Billing','Quotes','To Do > Items','Employee','Exit'] > mainmenucalls = [clientsmenu, jobsmenu, billingmenu, quotesmenu, > todomenu, empmenu, quit] > for i,option in enumerate(mainmenuoptions): > print('%s. %s' % (i, option)) > mainchoice = int(input('\nYour Choice? ')) > clearscreen(osname) > mainmenucalls[mainchoice]() > return > > It works well, but the first item is the list is item 0. This is > normal in most computing situations, but because this index is part of > the output It would be nice if the first item in the list is item 1. > > php provided a way to change this, but I can find no documentation > that says python can do this as well. > > I'm sure that python can do this, but I'm unable to find a definitive > answer with google. > > Would someone please enlighten me? > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor