字典 三級菜單

來源:互聯網
上載者:User

標籤:color   世界   海賊王   科學   while   輸入   探索   學技術   技術   

 1 #!-*- coding:utf-8 -*- 2 # Author:Steve 3  4 dict={‘TV‘: 5           {‘動漫‘:{ 6               ‘日漫‘:[‘海賊王‘,‘龍珠‘], 7               ‘國漫‘:[‘秦時明月‘,‘畫江湖‘] 8                  }, 9            ‘科教‘:{10               ‘動物‘:[‘動物世界‘,‘人與自然‘],11               ‘科技‘:[‘探索與發現‘,‘科學技術探索‘]12                     }13           }14      }15 16 exit_flag=False17 18 while not exit_flag:19    for i in dict:20        print(i)21    choice1=input("請輸入你想收看的頻道:(按Q退出)\n")22    if choice1 in dict:23        while not exit_flag:24            for i2 in dict[choice1]:25                print(‘\t‘,i2)26            choice2=input(‘請輸入您想收看的類型: (按B返回,按Q退出)\n‘)27            if choice2 in dict[choice1]:28                while not exit_flag:29                    for i3 in dict[choice1][choice2]:30                        print(‘\t\t‘,i3)31                    choice3=input(‘請輸入您想收看的節目: (按B返回,按Q退出)\n‘)32                    if choice3 in dict[choice1][choice2]:33 34                            for i4 in dict[choice1][choice2][choice3]:35                                print(‘\t\t\t‘,i4)36                            choice4=input(‘這已經是最後一層了。。。  (按B返回,按Q退出)\n‘)37                            if choice4==‘B‘:38                                pass39                            elif choice4 == "Q":40                                exit_flag = True41                    if choice3 == "B":42                        break43                    elif choice3 == "Q":44                        exit_flag = True45            if choice2 == "B":46                break47            elif choice2 == "Q":48                exit_flag = True

 

字典 三級菜單

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.