摘要: import sys,osBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))#__file__#os.path.abspath(__file__)获取当前文件的绝对路径#os.path.dirname()获取当 阅读全文
posted @ 2018-04-11 11:25 阜阳小全 阅读(140) 评论(0) 推荐(0) 编辑
摘要: #random 随机模块import randomprint(random.random()) #随机获取0到1的浮点数print(random.uniform(1,4)) #随机选取1到1之间的浮点数print(random.randint(1,4)) #随机获取[1,4]中的整型 可以去的值有1 阅读全文
posted @ 2018-04-11 11:24 阜阳小全 阅读(136) 评论(0) 推荐(0) 编辑
摘要: import time#time 模块# #时间戳 ,作计算用的print(time.time()) #得到的是浮点表达式。是描述,从1970年1月日凌晨开始算,到现在一共经历了多少秒 #当时Linux出现#localtime#结构化时间 ,当地时间,可以看出具体的年月日,甚至时间print(tim 阅读全文
posted @ 2018-04-11 11:23 阜阳小全 阅读(92) 评论(0) 推荐(0) 编辑
摘要: import time#time 模块# #时间戳 ,作计算用的print(time.time()) #得到的是浮点表达式。是描述,从1970年1月日凌晨开始算,到现在一共经历了多少秒 #当时Linux出现#localtime#结构化时间 ,当地时间,可以看出具体的年月日,甚至时间print(tim 阅读全文
posted @ 2018-04-10 21:46 阜阳小全 阅读(92) 评论(0) 推荐(0) 编辑
摘要: userlist = [ {'name':'doudou','passwd':'123'}, {'name':'chouchou','passwd':'456'}, {'name':'liuhaiquan','passwd':'789'}, {'name':'liuxue','passwd':'20 阅读全文
posted @ 2018-04-08 18:43 阜阳小全 阅读(101) 评论(0) 推荐(0) 编辑
摘要: #每执行一次函数,都要验证一下用户名和密码。#先写出index(), home(name), shopcar(name)的函数#然后再写出装饰器,装饰器在执行之前需要判断用户和密码def jd(yonghu): def gou(*args,**kwargs): username = input('用 阅读全文
posted @ 2018-04-08 17:35 阜阳小全 阅读(94) 评论(0) 推荐(0) 编辑
摘要: f1 = 2f2 = 1f1,f2 = f2,f1print(f1) #1print(f2) #2 阅读全文
posted @ 2018-04-08 14:45 阜阳小全 阅读(94) 评论(0) 推荐(0) 编辑
摘要: import time#装饰器的架子如下def timmer(func): def wrapper(*args,**kwargs): start_time = time.time() res = func(*args,**kwargs) #这一步就是在运行test stop_time = time. 阅读全文
posted @ 2018-04-08 14:10 阜阳小全 阅读(122) 评论(0) 推荐(0) 编辑
摘要: import time#装饰器的架子如下def timmer(func): def wrapper(): start_time = time.time() res = func() #这一步就是在运行test stop_time = time.time() print('程序运行时间是%s' %(s 阅读全文
posted @ 2018-04-08 13:32 阜阳小全 阅读(93) 评论(0) 推荐(0) 编辑
摘要: import time#装饰器的架子如下def timmer(func): def wrapper(): # print(func) start_time = time.time() func() #这一步就是在运行test stop_time = time.time() print('程序运行时间 阅读全文
posted @ 2018-04-08 13:24 阜阳小全 阅读(79) 评论(0) 推荐(0) 编辑