摘要: 发邮件需要第三方模块 pip install yamail 1 #import yagmail #--别人写的,发中文附件的时候是乱码 2 import yamail #牛牛基于yagmail改的 3 4 5 user = '123442323242@163.com' 6 password = 'Y 阅读全文
posted @ 2020-06-09 21:10 cjxxl1213 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 1 ''' 2 2、自己抓取qq群的接口,传入一个群号,然后把群成员的头像下载到本地,头像用群备注来命名,如果没有 3 群备注,那么取昵称。 4 ''' 5 import requests 6 import json 7 import os 8 import math 9 #1.获取QQ群的详细信息 阅读全文
posted @ 2020-05-26 19:51 cjxxl1213 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1.get请求 1 import requests 2 import datetime 3 #get请求 4 url = 'http://api.nnzhp.cn/api/user/stu_info' 5 req = requests.get(url,params={'stu_name':'abc' 阅读全文
posted @ 2020-05-25 21:28 cjxxl1213 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 1 import nnlog 2 import traceback 3 #level:输出日志级别,debug:把所有的日志都打印出来,info:打印info以上的日志, 4 # warning:打印warning以上的日志,error:只会打印error级别的日志 5 #backCount:备份几 阅读全文
posted @ 2020-05-25 20:04 cjxxl1213 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 什么是异常? 异常即是一个事件,该事件会在程序执行过程中发生,影响了程序的正常执行。 一般情况下,在Python无法正常处理程序时就会发生一个异常。 异常是Python对象,表示一个错误。 当Python脚本发生异常时我们需要捕获处理它,否则程序会终止执行。 常见的异常 异常名称描述 BaseExc 阅读全文
posted @ 2020-05-25 19:35 cjxxl1213 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 操作redis应先引入第三方模块 执行以下命令 pip install redis 1.redis常用方法 1 import redis 2 #decode_responses=True将bytes转成字符串 3 #Redis查出来的结果,默认是bytes类型的 4 r = redis.Redis( 阅读全文
posted @ 2020-05-24 21:00 cjxxl1213 阅读(121) 评论(0) 推荐(0) 编辑
摘要: python操作Excel需要引入第三方模块 执行以下命令: pip install xlwt pip install xlrd pip install xlutils 1.写Excel 1 import xlwt 2 3 book = xlwt.Workbook()#生成一个workbook 4 阅读全文
posted @ 2020-05-24 19:44 cjxxl1213 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 1 import json 2 import pymysql 3 IP = '127.0.0.1' 4 PORT = 3306 5 USER_NAME = 'root' 6 PASSWORD = '123456' 7 DB = 'db001' 8 def connect_mysql():#创建mys 阅读全文
posted @ 2020-05-17 13:58 cjxxl1213 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 1 ''' 2 写一个删除日志的程序,删除5天前或为空的日志,不包括当天的 3 1.删除5天前的日志文件 4 2.删除为空的日志文件 5 ''' 6 import os 7 import time 8 9 def delete_logs_file():#清理日志 10 for cur_dir,dir 阅读全文
posted @ 2020-05-17 13:57 cjxxl1213 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 1.创建连接 1 import pymysql 2 connect = pymysql.connect(host='127.0.0.1', 3 user='root', 4 password='123456', 5 db='db001', 6 port=3306, 7 charset='utf8', 阅读全文
posted @ 2020-05-17 13:55 cjxxl1213 阅读(178) 评论(0) 推荐(0) 编辑