摘要: a = lambda x:x+1 #冒号前是入参,冒号后是返回值 result = a(1) print(result) b = lambda x,y:x+y print(b(2,3)) # filter(str,[1,2,3,4,5]) res = filter(lambda x:str(x),[ 阅读全文
posted @ 2020-09-04 21:22 Mezhou 阅读(79) 评论(0) 推荐(0) 编辑
摘要: import os,sys,platform ini="""[global] index-url = https://pypi.doubanio.com/simple/ [install] trusted-host=pypi.doubanio.com """ os_version=platform. 阅读全文
posted @ 2020-09-04 21:21 Mezhou 阅读(107) 评论(0) 推荐(0) 编辑
摘要: import os,random,sys,time import string print(random.randint(1,100))#包含100 print(random.uniform(1,10))#小数 print(random.choice(string.ascii_lowercase)) 阅读全文
posted @ 2020-09-04 21:19 Mezhou 阅读(164) 评论(0) 推荐(0) 编辑
摘要: print(all([1,2,3,4]))#True 都为真才为真 print(all([1,2,3,0]))#False print(all([1,2,3,False]))#False print(any([1,2,3,4]))#True 都为False才为假 print(any([0,0,0,0 阅读全文
posted @ 2020-09-04 21:17 Mezhou 阅读(170) 评论(0) 推荐(0) 编辑
摘要: import time #时间戳 一串数字 #从unix元年 #格式化好的时间 2020-08-29 12:08:07 print(time.time())#当前时间戳 print(time.strftime('%Y-%m-%d %H:%M:%S'))#当前格式化好的时间 seven = int(t 阅读全文
posted @ 2020-09-04 21:15 Mezhou 阅读(504) 评论(0) 推荐(0) 编辑
摘要: import os print(os.listdir(r'E:\study\scripts\python\TMZ0\day5')) print(os.name)#操作系统 os.mkdir('java')#只可创建一个目录 os.makedirs('python/day1')#可创建多级目录,自动创 阅读全文
posted @ 2020-09-04 21:13 Mezhou 阅读(146) 评论(0) 推荐(0) 编辑