#三级菜单函数 menu = {'北京':{海淀:{'五道口':{}'中关村':{}'上帝':{}}'昌平':{}'朝阳':{}'东城':{}},'上海':{}'山东':{} } def threeMe(dic):while True:for k in dic:print(k)key = input('imput>>').strip()if key == 'b' or key == 'q':returnelif key in dic.keys() and dic[key]:ret = threeMe(dic[key])if ret == 'q':returnelif (not dic.get(key) or (not dic[key]):continuethreeMe(menu)