Python_三级菜单
1 area = { 2 '东城区':{ 3 '安定门街道':['五道营','永康','箭厂','国西','国东','方家'], 4 '建国门街道':['毛家湾办事处','东观音寺办事处','江擦办事处','西裱褙办事处','方巾巷办事处'], 5 '朝阳门街道':['本司胡同','大方家胡同','灯草胡同','礼士胡同'] 6 }, 7 '西城区':{ 8 '西长安街街道':['南北长街','府右街南','光明','西交民巷','北新华街'], 9 '金融街街道':['辖阜西','民康','锦北','王府仓','大喜'], 10 '牛街街道':['菜市口胡同','北半截胡同','南半截胡同','银行宿舍','烂缦胡同'] 11 }, 12 '朝阳区':{ 13 '南磨房地区':['双龙一','双龙二','双龙三','双龙四','双龙五'], 14 '高碑店地区':['高井','八里庄','北花园','高碑店','半堡店'], 15 '将台地区':['安家楼','驼房营','东八间房','西八间房'] 16 }, 17 }
1 while True: 2 for element in options: 3 print(element) 4 choose = input("Please enter your options:") 5 if choose in options: 6 options_list.append(options) 7 options = options[choose] 8 elif choose == "b": 9 if options_list: 10 options = options_list.pop() 11 12 else: 13 print("No such service!")