首页 > 编程语言 > 详细

python第五天

时间:2018-01-28 22:22:48      阅读:245      评论:0      收藏:0      [点我收藏+]
#Author:ge jian

data = {
‘北京‘:{
‘昌平‘:{
‘沙河‘:[‘oldboy‘,‘test‘],
‘天通苑‘:[‘链家‘,‘我爱我家‘]
},
‘朝阳‘:{
‘望京‘:[‘奔驰‘,‘陌陌‘],
‘国贸‘:[‘CICC‘,‘HP‘],
},
}
}
exit_flag = False

while not exit_flag:
for i in data:
print(i)

choice = input(‘选择输入1》》:‘)
if choice in data:
while not exit_flag:
for j in data[choice]:
print(‘\t‘,j)
choice1 = input(‘选择输入2》》:‘)
if choice1 in data[choice]:
while not exit_flag:
for k in data[choice][choice1]:
print(‘\t\t‘, k)
choice2 = input(‘选择输入3》》:‘)
if choice2 in data[choice][choice1]:
for l in data[choice][choice1][choice2]:
print(‘\t\t‘,l)
choice3 = input(‘最后一行,按b退出‘)

if choice3==‘b‘:
pass
elif choice3==‘q‘:
exit_flag = True
if choice2 == ‘b‘:
break
elif choice2 == ‘q‘:
exit_flag = True
if choice1 == ‘b‘:
break
elif choice1 == ‘q‘:
exit_flag = True
else:
exit_flag = True





python第五天

原文:https://www.cnblogs.com/gejian1991/p/8372609.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!