摘要: 1查看python包的版本 2 卸载包的方法 3指定python包的安装版本 参考网址 https://blog.csdn.net/colourful_sky/article/details/80182082 阅读全文
posted @ 2019-04-25 09:31 开心小耀子 阅读(116) 评论(0) 推荐(0) 编辑
摘要: import random def r_code(): code = '' for i in range(6): num = random.randint(0,9) alf = chr(random.randint(65,90)) add = random.choice([num,alf]) code = "".jo... 阅读全文
posted @ 2019-03-16 22:44 开心小耀子 阅读(89) 评论(0) 推荐(0) 编辑
摘要: import time print(time.strftime('%Y-%m-%d %H:%M:%S')) import time print(time.strftime('%Y-%m-%d %a %H:%M:%S')) import time t = time.time() print(time.localtime(3000000000)) print(time.gmtim... 阅读全文
posted @ 2019-03-16 22:36 开心小耀子 阅读(74) 评论(0) 推荐(0) 编辑
摘要: from collections import namedtuple Point = namedtuple('point',['x','y']) p = Point(1,2) print(p.x) print(p.y) print(p) import queue q = queue.Queue() q.put(10) q.put(5) q.put(2) print(q.get()) p... 阅读全文
posted @ 2019-03-16 21:43 开心小耀子 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 3.用map来处理字符串列表,把列表中所有人都变成sb,比方alex_sb 4.用filter函数处理数字列表,将列表中所有的偶数筛选出来 5.随意写一个20行以上的文件运行程序,先将内容读到内存中,用列表存储。接收用户输入页码,每页5条,仅输出当页的内容 阅读全文
posted @ 2019-03-14 14:05 开心小耀子 阅读(178) 评论(0) 推荐(0) 编辑
摘要: # ret = zip((('a'),('b')),(('c'),('d'))) # for i in ret: # print(i) # def func(tup): # return {tup[0]:tup[1]} # res = map(func,ret) # print(list(res)) ret = zip((('a'),('b')),(('c'),('d'))) r... 阅读全文
posted @ 2019-03-13 22:49 开心小耀子 阅读(121) 评论(0) 推荐(0) 编辑
摘要: ret = map(abs,[-1,1,2,3]) print(ret) for i in ret: print(i) l = [1,-2,3,6,8,-7] l.sort(key=abs) print(l) 阅读全文
posted @ 2019-03-11 22:14 开心小耀子 阅读(72) 评论(0) 推荐(0) 编辑
摘要: def is_odd(x): return x % 2 == 1 ret = filter(is_odd, [1,4,6,7,9]) print(ret) for i in ret: print(i) def is_str(s): return type(s) == str ttt = filter(is_str, [1, 'hello']) print(ttt... 阅读全文
posted @ 2019-03-11 21:41 开心小耀子 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1处理文件,用户指定要查找的文件和内容,将文件中包含要查找内容的每一行都输出到屏幕 2 写生成器,从文件中读取内容,在每一次读取到的内容之前加上‘***’之后再返回给用户 阅读全文
posted @ 2019-03-05 22:37 开心小耀子 阅读(128) 评论(0) 推荐(0) 编辑