Development environment:
os:64-bit Windows 7
ide:pycharm4.0.4
Python version: 2.7.10
Program Description:
A, the program realizes the function for the fans can choose their favorite team and players
b, the program a total of three levels of directory, the first level of the East and West Division, the second level for the team list under each section, the third level for the team list of players List, each player's basic information for the player play role
C, in each level of the directory, the customer can be selected in the level directory, the corresponding option, q corresponding exit the entire program, B represents back to the previous level to re-select.
Copyright Notice:
This multilevel menu program is only used for Python learning, copyright has the author, without the author's consent, may not be used for commercial use of this multilevel menu program.
#-*-coding:utf-8-*-__author__='Bruce'levelist= { 'eastdist': { "Cavs":{ "LBJ":['F'], " Love":["C"], "iving":["S"] }, "Bulls":{ "Rose":["S"], "Gassol":["C"], "Butter":['F'] }, "Heat":{ "Wade":["S"], "Bosh":["F"], "Deng":["S"] }, }, "westdist": { "Warriors":{ "Curry":["S"], "Thompson":["S"], "Green":['F'] }, "Spurs":{ "Duncan":['F'], "Park":["S"], "Ginobili":["S"] }, "Thunders":{ "Durant":['F'], "Wesbrook":["S"], "Yibaka":["C"]},},}flag=True whileflag:Print '----------------------Partition Selection-------------------------------------' forIinchRange (len (Levelist.keys ())):PrintI,levelist.keys () [i]Print '------------------------------------------------------------------'Dictselect= Raw_input ("Select the team partition (press Q to exit):"). Strip ()Print "-------------------------Team Choose----------------------------------" #if Dictselect.isdigit (): #无法判断选项以外的其他数字, Error ifDictselect = ="0" orDictselect = ="1": Dictselect=Int (dictselect)#print Levelist.keys () [Dictselect] #取出分区名字, and the key value of the team dictionaryDictkey = Levelist.keys () [Dictselect]#Remove the partition name and the key value of the team dictionary whileflag: forJinchRange (len (levelist[dictkey)):PrintJ,levelist[dictkey].keys () [j]#print '------------------------------------------------------------------' #print Levelist[teamkey].keys () [1]Teamselect = Raw_input ("Select the team number (press Q to exit and press B to return to the previous level):"). Strip ()Print "-------------------------player Selection----------------------------------" ifteamselect.isdigit (): Teamselect=Int (teamselect) Teamkey= Levelist[dictkey].keys () [Teamselect]#Remove the team name and also the key value of the player dictionary #print Teamkey #取出球队名字 and is also the key value of the player dictionary #print Levelist[dictkey][teamkey] #取出 [partition] [team] below the player dictionary whileflag: forLinchRange (len (levelist[dictkey][teamkey)):PrintL,levelist[dictkey][teamkey].keys () [L]Print '---------------------------------------------------------------'Playerselect= Raw_input ("Select the player serial number (press Q to exit and press B to return to the previous level):"). Strip ()ifplayerselect.isdigit ():Print "In the end, please select Q to exit, or press B to return to the previous level" elifPlayerselect = ="b": Break elifPlayerselect = ="Q": Flag=False# Break Else: Print "your input is wrong, please re-enter" elifTeamselect = ="b": Break elifTeamselect = ="Q": Flag=FalseElse: Print "your input is wrong, please re-enter" elifDictselect = ="Q": Flag=FalseElse: Print "your input is wrong, please re-enter"
Python Learning---Level three menu