当前位置:网站首页>Three level menu applet
Three level menu applet
2022-06-26 03:48:00 【Just call me ah Jie】
Implement a three-level menu , Back off , Quit at any time , You can go back to
menu = {
' Beijing ':{
' haidian ':{
' Wudaokou ':{
'soho':{},
' NetEase ':{},
'google':{}
},
' Zhongguancun ':{
' Iqiyi ':{},
' Car home ':{},
'youku':{},
},
' On the ground ':{
' Baidu ':{},
},
},
' Changping ':{
' Shahe ':{
' The old boy ':{},
' Beihang ':{},
},
' Tiantongyuan ':{},
' Huilongguan ':{},
},
' The rising sun ':{},
' Dongcheng ':{},
},
' Shanghai ':{
' Minhang ':{
" People's Square ":{
' Fried chicken ':{}
}
},
' Zhabei ':{
' Train war ':{
' Ctrip ':{}
}
},
' In the pudong new area ':{},
},
' Shandong ':{},
}
current = menu
gyf=[menu]
while True:
for i in current.keys():
print(i)
a = input('>').strip()
if a == 'b':
current=gyf[-1] # current The last one is to keep the previous menu
if len(gyf) > 1: # Prevent multiple errors when exiting the first level menu
gyf.pop() # After getting the upper menu, delete the last one , At this point, the last one is the upper level menu
elif a in ('q','quit'):
break
elif a not in current:
continue
else:
gyf.append(current) # Put the current menu to the last place every time
current=current[a] # Put subordinate menus in current, In this way, the lower level menu will be printed
边栏推荐
- Uni app swiper rotation chart (full screen / card)
- Upload file / text / picture, box shadow
- WebRTC系列-网络传输之6-Connections裁剪
- 虚拟化是什么意思?包含哪些技术?与私有云有什么区别?
- Intelligent manufacturing learning videos and books
- Uni app Baidu cloud realizes OCR ID card recognition
- Pay attention to the entrance components of official account in the applet
- 【Flink】Flink Sort-Shuffle写流程简析
- Solve the problem that the uniapp plug-in Robin editor reports an error when setting the font color and background color
- ABP framework Practice Series (II) - Introduction to domain layer
猜你喜欢
Comparison of static methods and variables with instance methods and variables
Camera memory memory leak analysis (III)
【Flink】Flink Sort-Shuffle写流程简析
Nebula Graph学习篇3_多线程完成6000w+关系数据迁移
Digital twin intelligent water service, breaking through the development dilemma of sponge City
Can string be changed?
Uni app custom navigation bar component
Non H5 end of uni app, regional setting of status bar on the top of mobile phone
How to prepare for a moving wedding
Uni app custom drop-down selection list
随机推荐
Evaluation - analytic hierarchy process
Navicat16 wireless trial
Kotlin learning apply plugin: 'kotlin Android extensions‘
Camera memory memory leak analysis (III)
高性能算力中心 — RoCE — Overview
ASP. Net core introduction
An easy-to-use tablayout
mysql存儲過程
Ieda suddenly cannot find compact middle packages
【MySQL】 MySQL 导出数据库
763. 划分字母区间
xml 解析bean工具类
2022.6.25-----leetcode. Sword finger offer 091
navicat16无线试用
Sqlitestudio download address
Is it safe for individuals to buy stocks with flush software? How to buy stocks
MySQL development environment
Introduction of mybatis invalid
Uni app Baidu cloud realizes OCR ID card recognition
MySQL stored procedure