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

yipeiwu_com5年前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实现二级登陆菜单及安装过程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对【听图阁-专注于Python设计】网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

相关文章

Python实现淘宝秒杀聚划算抢购自动提醒源码

说明 本实例能够监控聚划算的抢购按钮,在聚划算整点聚的时间到达时发出提醒(音频文件自己定义位置)并自动弹开页面(URL自己定义)。 同时还可以通过命令行参数自定义刷新间隔时间(默认0.1...

解决pandas无法在pycharm中使用plot()方法显示图像的问题

最近用了pycharm,感觉还不错,就是pandas中Series、DataFrame的plot()方法不显示图片就给我结束了,但是我在ipython里就能画图 以前的代码是这样的...

在Python中通过threading模块定义和调用线程的方法

定义线程 最简单的方法:使用target指定线程要执行的目标函数,再使用start()启动。 语法: class threading.Thread(group=None, targe...

在vscode中配置python环境过程解析

在vscode中配置python环境过程解析

1.安装vscode和python3.7(安装路径在:E:\Python\Python37); 2.打开vscode,在左下角点击设置图标选择setting,搜索python path,...

利用Python中的pandas库对cdn日志进行分析详解

前言 最近工作工作中遇到一个需求,是要根据CDN日志过滤一些数据,例如流量、状态码统计,TOP IP、URL、UA、Referer等。以前都是用 bash shell 实现的,但是当日志...