欢迎来到代码驿站!

Python代码

当前位置:首页 > 软件编程 > Python代码

python实现二级登陆菜单及安装过程

时间:2021-02-11 11:23:00|栏目:Python代码|点击:

python实现二级登陆菜单的代码如下所示:

"""
 1.三级菜单 注册 登陆 注销
 2.进入每一个一级菜单,都会有下一级的菜单
"""
user_item = dict()
try:
  while True:
    print('-------Welcome sir-------')
    input_choice = int(input('Please enter your choice:1:Registration 2:login 3:logout:'))
    # 用户输入自己的选择,会进入到相关的二级菜单
    if input_choice == 1:
      # if input_choice==1 进入注册
      user = input('Please enter your account number:')
      pwd = input('please enter your password:')
      # 保存用户注册的账号
      user_item['user'] = user
      user_item['pwd'] = pwd
      # 提示用户注册成功
      print('您的账号已生效,下次请用该账号:{}登陆本系统'.format(user))
    # if input_choice==2 进入登陆
    elif input_choice == 2:
      login_user = input('Please enter your login account number:')
      login_pwd = input('please enter your login password:')
      # 对用户输入的账号和密码进行确认
      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 进入注销
    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.安装过程(自动添加安装路径):

4.手工添加路径:

a.【右键计算机】-->【属性】-->【高级系统设置】-->【高级】-->【环境变量】:
b.【在第二个内容框中(系统变量)找到 变量名为Path 的一行,双击】 --> 【把Python安装目录追加到其中,用英文下的分号(;)分割,切记前面有分号】

5.查看是否安装成功:

 Windows下,开始(快捷键:Windows+R)-cmd,输入命令:python 

总结

上一篇:在Python 2.7即将停止支持时,我们为你带来了一份python 3.x迁移指南

栏    目:Python代码

下一篇:Python实现Smtplib发送带有各种附件的邮件实例

本文标题:python实现二级登陆菜单及安装过程

本文地址:http://www.codeinn.net/misctech/61292.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有