上一页 1 2 3 4 5 6 7 8 ··· 11 下一页
摘要: import yamail # import yagmail #发附件的附件如果是中文名是乱码 username = 'testing_dhcc@163.com' passwd = 'aaaaaaa'#授权码 # smtp = yamail.SMTP(host='smtp.qq.com', # us 阅读全文
posted @ 2020-09-12 20:12 Mezhou 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑
摘要: 函数参数顺序: 1、必填参数2、默认值参数3、参数组4、关键字参数 必填参数 import string def check_password(password):#必传参数,也叫位置参数 p = set(password) if p & set(string.digits) and p & set 阅读全文
posted @ 2020-08-28 22:13 Mezhou 阅读(515) 评论(0) 推荐(0) 编辑
摘要: 三元表达式和列表生成式可以简化代码 age = 18 if age <18: v='未成年人' else: v='成年人' v = '未成年人' if age < 18 else '成年人' a = [1,2,3,4,5] b=[] for i in a: b.append(str(i))#列表中的 阅读全文
posted @ 2020-08-28 22:04 Mezhou 阅读(181) 评论(0) 推荐(0) 编辑
摘要: json是种通用数据类型 ,json就是字符串,所有语言都可以解析 { "name": "xiaohei", "cars": [ 1, 2, 3 ], "house": [ 4, 5, 6 ], "tt": "哈哈" } python中json和dict可以互转 由json转dict用loads,e 阅读全文
posted @ 2020-08-28 21:57 Mezhou 阅读(140) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 11 下一页