标签:ror 代码 app append exit list() for 菜单 end
再也不想看之前的low代码了。。。
#!/usr/bin/env python data = { ‘北京‘: { "昌平": { "望京1": {"奔驰", "默默"}, "国贸2": ("cicc", "HP"), }, "朝阳": { "望京1": {"奔驰", "默默"}, "国贸1": ("cicc", "HP"), }, }, ‘山东‘: { "昌平": { "望京1": {"奔驰", "默默"}, "国贸2": ("cicc", "HP"), }, "朝阳": { "望京2": {"奔驰", "默默"}, "国贸2": ("cicc", "HP"), }, }, ‘广东‘: { "昌平": { "望京1": {"奔驰", "默默"}, "国贸2": ("cicc", "HP"), }, "朝阳": { "望京3": {"奔驰", "默默"}, "国贸4": ("cicc", "HP"), }, }, } current_layer = data layerlist = list() while True: for i in current_layer: print(i) choice = input("选择进入,按b返回,按q退出>>:") if choice in current_layer: try: layerlist.append(current_layer) current_layer = current_layer[choice] except TypeError: current_layer = current_layer continue elif choice.lower() == ‘b‘: try: current_layer = layerlist.pop() except IndexError: pass continue elif choice.lower() == ‘q‘: exit("bye~~")
标签:ror 代码 app append exit list() for 菜单 end
原文地址:https://www.cnblogs.com/a10086/p/9236671.html