摘要:
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
阅读(209)
评论(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
阅读(246)
评论(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
阅读(183)
评论(0)
推荐(0)
摘要:
1.时间模块常用方法 1 import time,datetime 2 #格式化好的时间2020-05-16 18:30:52 3 #时间戳1589616753 从unix元年(计算机发明的时间)到现在过了多少秒 4 print(time.time())#获取当前的时间戳 5 print(time. 阅读全文
posted @ 2020-05-17 13:48
cjxxl1213
阅读(160)
评论(0)
推荐(0)
摘要:
os操作文件,可以输入绝对路径,也可以输入相对路径 windows使用路径用\连接 Linux使用路径用/连接 但是我的电脑是windows 用/也没问题 1.os常用方法 1 import os 2 print(os.path.join('e:','movies','a.mp4'))#拼接路径 3 阅读全文
posted @ 2020-05-17 13:44
cjxxl1213
阅读(219)
评论(0)
推荐(0)