python编程—后台管理系统
2022-08-03 09:57:03
247
{{single.collect_count}}

题目描述:

# 1. 后台管理员只有一个用户: admin, 密码: admin# 2. 当管理员登陆成功后, 可以管理前台会员信息.# 3. 会员信息管理包含:# 添加会员信息# 删除会员信息# 查看会员信息# 退出 - 添加用户:1). 判断用户是否存在?2).如果存在, 报错;3).如果不存在,添加用户名和密码分别到列表中;- 删除用户1). 判断用户名是否存在2). 如果存在,删除;3). 如果不存在, 报错;

代码如下:

"""# _*_coding:utf-8_*_Name:houtai.pyDate:1/16/19Author:westos-sqlConnect:2910903196@qq.comDesc:..."""user = ['root','westos']passwd = ['123','456']str = 'Backstage System'AdminName = input('AdminName: ')AdminPasswd = input('AdminPasswd: ')menu = '''1. Add2. Delete 3. Find4. Quit'''while True:if AdminName == "admin" and AdminPasswd == 'admin':print('Login Successful')print(str.center(30,'*'))print(menu)####Add userchoose = input('Please Input Your choose:')if choose == '1':Name = input('name:')if Name in user:print('User existed')else:user.append(Name)Passwd = input('Please set your passwd:')passwd.append(Passwd)print('Adding User Successfully')####Delete userelif choose == '2':DelName = input('You want delete:')if DelName not in user:print('Delete Failed')else:i = user.index(DelName)user.remove(DelName)passwd.pop(i)print('User has already delete')####Find userelif choose == '3':CheckName = input('Who you want to find: ')if CheckName in user:print('User is %s' %CheckName)else:print('Not Found')####Exit Systemelif choose == '4':print('You will exit system')exit()else:print('Please input right AdminName and AdminPasswd')exit()

测试结果:
在这里插入图片描述

在这里插入图片描述

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}