摘要:
一、发邮件 1 import yagmail 2 3 #邮箱服务 4 mail_server = 'smtp.163.com' #163邮箱服务 5 mail_server = 'smtp.qq.com' #qq邮箱服务 6 mail_server = 'smtp.126.com' #126邮箱服务 阅读全文
posted @ 2019-11-19 15:43
xmb
阅读(114)
评论(0)
推荐(0)
摘要:
一、写日志 1 import nnlog 2 #参数1,log的路径,可以是一个不存在的文件,会主动创建 3 #参数2,level可指定日志的级别 4 #参数3,backCount可指定日志保存的天数;when='D'代表每天产生一个日志文件,M代表每分钟产生一个日志文件,S代表每秒产生一个日志文件 阅读全文
posted @ 2019-11-19 15:31
xmb
阅读(171)
评论(0)
推荐(0)
摘要:
一、操作redis 1 import redis 2 #decode_responses=True 直接返回字符串 3 r = redis.Redis(host='127.0.0.0',password='HK1213',port=6379,db=0,decode_responses=True) 4 阅读全文
posted @ 2019-11-19 11:22
xmb
阅读(127)
评论(0)
推荐(0)
摘要:
一、迁移redis 思路: 1、获取a redis里面所有的key 2、判断key的类型:sting、hash 3、然后根据key的类型set或hset到b redis里 1 import redis 2 r = redis.Redis(host = '127.0.0.0',password='HK 阅读全文
posted @ 2019-11-19 11:22
xmb
阅读(179)
评论(0)
推荐(0)
摘要:
一、md5加密 import hashlib #md5加密 h = 'xmb' m = hashlib.md5(h.encode()) result = m.hexdigest() #获取加密后的结果 print(result) #加盐 y = 'abc' password = input('pas 阅读全文
posted @ 2019-11-19 11:22
xmb
阅读(172)
评论(0)
推荐(0)
摘要:
一、base64加密、解密 import base64 s = 'abc' b = base64.b64encode(s.encode()) #加密 result = b.decode() print(result) b = base64.b64decode('YWJj') #解密 print(b. 阅读全文
posted @ 2019-11-19 11:21
xmb
阅读(103)
评论(0)
推荐(0)
摘要:
一、写excel 1 import xlwt 2 book = xlwt.Workbook() 3 sheet = book.add_sheet('sheet1') 4 #行 5 sheet.write(0,0,'名字') 6 sheet.write(0,1,'性别') 7 sheet.write( 阅读全文
posted @ 2019-11-19 11:21
xmb
阅读(88)
评论(0)
推荐(0)
摘要:
一、操作MySQL 1 def op_mysql(sql,many=True): 2 db_info = {'user':'xmb','password':'123456','host':'127.0.0.0','db':'xmb','port':3306,'charset':'utf8','aut 阅读全文
posted @ 2019-11-19 11:21
xmb
阅读(195)
评论(0)
推荐(0)
摘要:
一、网络请求 1 import requests 2 3 #get请求 4 url = 'http://127.0.0.0/api/user/stu_info' 5 data = {"stu_info":"xiaoming"} 6 result = requests.get(url,data).te 阅读全文
posted @ 2019-11-19 11:20
xmb
阅读(293)
评论(0)
推荐(0)

浙公网安备 33010602011771号