python某公司为员工发放奖品_python练习题-员工信息表

importosname_list= ['id', 'name', 'age', 'phone', 'job'] #创建列名列表ditons=['>','user_dic={'name':'admin','passwd':'123456'}status={'name':None,'passwd':False,'login':False}defauth(x):def user_auth(*...
摘要由CSDN通过智能技术生成

importos

name_list= ['id', 'name', 'age', 'phone', 'job'] #创建列名列表

ditons=['>','

user_dic={'name':'admin','passwd':'123456'}

status={'name':None,'passwd':False,'login':False}defauth(x):def user_auth(*args,**kwargs):if not status['login']:#获取user_dic字典里面的login值

username=input('请输入用户名')

userpasswd=input('请输入密码')if username==user_dic['name'] and userpasswd==user_dic['passwd']:#判断账户密码是否正确

status['name']=username #如果正确修改user_dic里面的信息

status['passwd']=userpasswd

status['login']=Trueprint('登陆成功')

res=x(*args,**kwargs)returnreselse:print('用户名或密码输入错误')else:#如果login为True,直接执行函数

res=x(*args,**kwargs)returnresreturn user_auth#函数闭包

defcheck():

s=input('请输入查询语句,例如 select * where age=25\n')if 'select' and 'where'in s:#检查输入语句是否正确

content, condition = s.split('where') #以where分割s,并且赋值给content,condition

content = ''.join(content.split('select')[1:]) #content 以select分割,取最后一个赋值给content

if content.strip() and condition.strip(): #判断 如果content 和condition都不为空,执行下面语句

for key in ditons: #for循环遍历ditions,

if key in condition: #如果key 在condition里面的话,执行下列语句

index_condition = ditons.index(key)#获取key在ditons里面的索引

name, cond = condition.strip().split(key)#以key分割condition,赋值给name,cond

if name in name_list:#如果name在name_list里面,执行下列语句

with open('mysql', encoding='u

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值