Python3 简单的三级列表思路

Python3 简单的三级列表思路(初学者 比较low)

代码如下:

info = {
    '北京':{
        '沙河':['benz','momo'],
        '朝阳':['北土城','健德门'],
        '国贸':['女明星','HP']
    },
    '山东':{},
    '广东':{}
}
while True:
    for i in info:
        print(i)
    user_choice = input('please input your choice>>>').strip()
    if user_choice in info:
        while True:
            for i2 in info[user_choice]:
                print(i2)
            user_choice2 = input('please input your choice>>>').strip()
            if user_choice2 in info[user_choice]:
                while True:
                    for i3 in info[user_choice][user_choice2]:
                        print(i3)
                    user_choice3 = input('please input your choice>>>').strip()
                    if user_choice3 == 'q':
                        exit()

  

原文地址:https://www.cnblogs.com/hjc4025/p/6485467.html