python實(shí)現(xiàn)二級(jí)登陸菜單的代碼如下所示:
""" 1.三級(jí)菜單 注冊(cè) 登陸 注銷 2.進(jìn)入每一個(gè)一級(jí)菜單,都會(huì)有下一級(jí)的菜單 """ user_item = dict() try: while True: print('-------Welcome sir-------') input_choice = int(input('Please enter your choice:1:Registration 2:login 3:logout:')) # 用戶輸入自己的選擇,會(huì)進(jìn)入到相關(guān)的二級(jí)菜單 if input_choice == 1: # if input_choice==1 進(jìn)入注冊(cè) user = input('Please enter your account number:') pwd = input('please enter your password:') # 保存用戶注冊(cè)的賬號(hào) user_item['user'] = user user_item['pwd'] = pwd # 提示用戶注冊(cè)成功 print('您的賬號(hào)已生效,下次請(qǐng)用該賬號(hào):{}登陸本系統(tǒng)'.format(user)) # if input_choice==2 進(jìn)入登陸 elif input_choice == 2: login_user = input('Please enter your login account number:') login_pwd = input('please enter your login password:') # 對(duì)用戶輸入的賬號(hào)和密碼進(jìn)行確認(rèn) if login_user == user_item['user'] and login_pwd == user_item['pwd']: print('Welcome sir:{}'.format(login_user)) else: print('Sorry, your account or password is incorrect. Please confirm and come back') # if input_choice == 3 進(jìn)入注銷 elif input_choice == 3: logout_input = input('Do you really want to quit this system?,y or n') if logout_input == 'y': break elif logout_input == 'n': input_choice = int(input('Please enter your choice:1:Registration 2:login 3:logout:')) else: print('Your input is incorrect') except Exception as re: print(re) finally: print('')
下面看下python 安裝過程。
Python安裝
Windows:
1.下載地址:
https:
/
/
www.python.org
/
downloads
/
2.百度云盤分享地址:
鏈接:https://pan.baidu.com/s/1FJ0fXs6mIBm342AJ4ZXNhw
提取碼:768z
3.安裝過程(自動(dòng)添加安裝路徑):
4.手工添加路徑:
a.【右鍵計(jì)算機(jī)】-->【屬性】-->【高級(jí)系統(tǒng)設(shè)置】-->【高級(jí)】-->【環(huán)境變量】:
b.【在第二個(gè)內(nèi)容框中(系統(tǒng)變量)找到 變量名為Path 的一行,雙擊】 --> 【把Python安裝目錄追加到其中,用英文下的分號(hào)(;)分割,切記前面有分號(hào)】
5.查看是否安裝成功:
Windows下,開始(快捷鍵:Windows+R)-cmd,輸入命令:python
總結(jié)
以上所述是小編給大家介紹的python實(shí)現(xiàn)二級(jí)登陸菜單及安裝過程,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
