menu = {'profile':{'user':{'name':{'raimond'}}}}
layers = [menu,]
while True:
if len(layers) == 0:break
cur_layer = layers[-1]
for key in cur_layer:
print(key)
choice = input('>>>').strip()
if choice == 'q': break
if choice == 'b':
layers.pop()
continue
if choice not in cur_layer:continue
layers.append(cur_layer[choice])
C:\Users\user\AppData\Local\Programs\Python\Python36\python.exe “C:/Users/user/PycharmProjects/hellow python/test.py”
profile
please input:profile
user
please input:user
name
please input:name
raimond
please input:b
name
please input:b
user
please input:b
profile
please input:b
Process finished with exit code 0