review what i studied `date` - 2017-4-17
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了review what i studied `date` - 2017-4-17相关的知识,希望对你有一定的参考价值。
老男孩day1作业:login
[[email protected] day1]# cat day1homework.py #!/bin/env python import sys #加载sys模块 使用退出命令 file = ‘user.lock‘ #黑名单文件 f = open(file,‘a‘) #以附加模式打开文件,没有则创建 f.close() #关闭一次下次在用其他模式调用 f = open(file,‘r‘) #读取模式打开 login = "0" for fail in range(0,3): username = "" password = "" while username == ‘‘ and login == "0": #判断两个条件当没有登录和用户名为空时循环 username = raw_input(‘Pls input your username:‘).strip() if username == "": print "username can‘t be empty " continue elif username in f.read(): print "user is locked" sys.exit() #检测到用户名存在于黑名单中,退出 while password == ‘‘ and login == "0": password = raw_input(‘Pls input you password:‘).strip() if password == "": print "password can‘t be empty " continue if username == ‘xuhui‘ and password == ‘123456‘: f.close() print ‘login successful‘ login = ‘1‘ #设置login位 为1不会再去开启两个while循环 break else: print ‘username or password incorrect‘ else: if fail == 2 and login == "0": #当输入了三次还没有登录则加入黑名单 f.close() print ‘login lock‘ f = open(file,‘a‘) f.write(username) f.close()
数据库如何存放图片
1、将图片转换成二进制流存入数据库
2、在数据库中存放图片的url
http://soft.chinabyte.com/database/91/12333591.shtml
以上是关于review what i studied `date` - 2017-4-17的主要内容,如果未能解决你的问题,请参考以下文章
review what i studied `date` - 2017-4-22
review what i studied `date` - 2017-4-9
review what i studied `date` - 2017-4-11
review what i studied `date` - 2017-4-24