#!/usr/bin/env python#-*-coding:utf-8-*-#Author:DaShuang.Gu#Level Three menudata = { 'Beijing':{ "changping":{ "Shahe":["Oldboy","Test"], "Tin Tong Court":["Chain Home Property","I love my family ."] }, "Chaoyang":{ "Wangjing":["Mercedes","mo Mo"], "Guomao":{"CICC","HP"}, "Dong Zhi men":{"Advent","fetion"}, }, "Haidian":{}, }, 'Shandong':{ "Texas":{}, "Qingdao":{}, "Jinan":{} }, 'Guangdong':{ "Dongguan":{}, "Changshu":{}, "Foshan": {},},}flag=True whileflag: forLinchData:Print(L) Choice1= Input ("choose to enter 1>>:") ifChoice1inchData: whileflag: forL1inchData[choice1]:Print('\ t', L1) Choice2= Input ("choose to enter 2>>:") ifChoice2inchData[choice1][choice2]: whileflag: forL2inchData[choice1][choice2]:Print('\t\t', L2) Choice3= Input ("choose to enter 3>>") ifChoice3inchData[choice1][choice2][choice3]: whileflag: forL3inchData[choice1][choice2][choice3]:Print('\t\t\t', L3) Choice4= Input ("last layer Press B to return to >>:") ifChoice4 = ="b": Break elifChoice4 = ="Q": Flag=FalseifChoice3 = ="b": Break elifChoice3 = ="Q": Flag=FalseifChoice2 = ="b": Break elifChoice2 = ="Q": Flag= False
View Code
Python Automation Development-ex.2 (Level three menu)