摘要: import random **print(random.random())#0-1 **print(random.randint(1,8))[1-8]****print(random.randrange(1,3)) random.randrange(10) **print(random.choic 阅读全文
posted @ 2018-10-16 20:05 zhaoweiscsuse 阅读(107) 评论(0) 推荐(0)
摘要: import timeprint(help(time.strftime))#注释文档 ***time.sleep(0.1) ***print(time.time())#时间戳1539659532.6734543print(time.mktime(time.localtime())#得到时间戳 pri 阅读全文
posted @ 2018-10-16 20:05 zhaoweiscsuse 阅读(117) 评论(0) 推荐(0)
摘要: 生成器属于迭代器迭代器包括[字符,列表,元组,字典] a = [1,2,3,]d = iter(a) print(d) # <list_iterator object>print(next(d))d--迭代器Iterator a--迭代器对象Iterable 迭代器条件:1.有iter方法2.有ne 阅读全文
posted @ 2018-10-16 20:04 zhaoweiscsuse 阅读(117) 评论(0) 推荐(0)
摘要: 列表生成式 a = [x*2 for x in range(10)] a = [x*2 for x in a] def f(n):return n+1 a = [f(x) for x in range(10)] print(a) #[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 列表生成器 s = (x*2 for x in range(5)) print(s) # ... 阅读全文
posted @ 2018-10-16 20:01 zhaoweiscsuse 阅读(155) 评论(0) 推荐(0)
摘要: #需求:京东购物前必须要登录,而再次点击购物时, # 在新的页面(函数)中,不需要再次输入信息。# 怎么做到? # 现在在每个功能模块,都要调用信息登录函数,# 未免太麻烦,怎样做就简单了?# 只要登录一次,第二次检测是否登录即可。# 或者说,每次先检验是否登录。 具体实现代码 阅读全文
posted @ 2018-10-16 19:58 zhaoweiscsuse 阅读(349) 评论(0) 推荐(0)