Python——三级菜单
生活随笔
收集整理的這篇文章主要介紹了
Python——三级菜单
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#三級菜單函數
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)
?
轉載于:https://www.cnblogs.com/cxys85/p/9760734.html
總結
以上是生活随笔為你收集整理的Python——三级菜单的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 做梦梦到香瓜是什么意思
- 下一篇: python中不需要函数重载的原因