#!/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"), }, }, } quit_q="" while quit_q!='q': for i1 in data: print(i1) choice1=input("选择进入,按b返回,按q退出>>:") quit_q=choice1 if choice1== 'b': break if choice1 in data: while quit_q!='q': for i2 in data[choice1]: print("\t",i2) choice2 = input("选择进入,按b返回,按q退出>>:") quit_q = choice2 if choice2 == 'b': break if choice2 in data[choice1]: while quit_q!='q': for i3 in data[choice1][choice2]: print("\t\t", i3) choice3 = input("选择进入,按b返回,按q退出>>:") quit_q = choice3 if choice3 == 'b': break if choice3 in data[choice1][choice2]: while quit_q != 'q': for i4 in data[choice1][choice2][choice3]: print("\t\t\t", i4) choice4 = input("最后一层,按b返回,按q退出>>:") quit_q = choice4 if choice4 == 'b': break