01 2021 档案

摘要:#select * from user where username="%s";' % username #登陆 import hashlibimport string, datetimeimport pymysql# 检查用户是否在数据库中def check_user_exist(username 阅读全文
posted @ 2021-01-29 12:02 术成 阅读(118) 评论(0) 推荐(0)
摘要:#select * from user where username="%s";' % username #注册 import hashlibimport stringimport pymysql# 检查表是否存在,不存在先建表def checktable_isexist(): cur.execut 阅读全文
posted @ 2021-01-29 12:01 术成 阅读(249) 评论(0) 推荐(0)
摘要:写一个函数,传入表名和数据库名,然后把这个表里面所有的数据导出到excel里面def export_to_excel(table_name,db_name): import pymysqlimport xlwt,xlutilsmysql_info = { "host": "118.24.3.40", 阅读全文
posted @ 2021-01-27 19:52 术成 阅读(80) 评论(0) 推荐(0)
摘要:import datetime,osimport timetime_str = time.strftime('%Y-%m-%d') #时间字符串print(time_str)time_tuple = time.strptime(time_str,'%Y-%m-%d')print(time_tuple 阅读全文
posted @ 2021-01-22 19:15 术成 阅读(171) 评论(0) 推荐(0)
摘要:#!/usr/bin/python# -*- coding:utf-8 -*-import jsonimport xlrdimport xlwtfrom xlutils import copystr_json = '{"1":["小花",99,100,98.5],"2":["小王",90,30.5, 阅读全文
posted @ 2021-01-22 19:13 术成 阅读(224) 评论(0) 推荐(0)
摘要:需求: 1、写一个清理日志的代码 1.1、删除3天前的日志文件1.2、删除文件内容为空的日志文件1.3、如果当天的日志文件为空,不删除 import os,sys# print(os.getcwd())# print(os.listdir())# C:\Users\Administrator\Des 阅读全文
posted @ 2021-01-21 17:32 术成 阅读(594) 评论(0) 推荐(0)
摘要:# 登录# with open('user.txt','r',encoding = 'utf-8') as far:# ls = far.read().strip().split("\n")# print(ls)import timeusername_inp = input("请输入用户名:")pw 阅读全文
posted @ 2021-01-14 00:11 术成 阅读(258) 评论(0) 推荐(0)
摘要:# #!/usr/bin/python# # -*- coding:utf-8 -*-# 注册import jsonimport string,random# def check_username(username):# return set(username) & set(string.ascii 阅读全文
posted @ 2021-01-13 20:43 术成 阅读(105) 评论(0) 推荐(0)
摘要:import string,random# from random import randint ,samplenumber = input("请随机输入生成的条数:").strip()if not number.isdigit(): print("输入整数")else: number = int( 阅读全文
posted @ 2021-01-13 14:01 术成 阅读(648) 评论(0) 推荐(0)
摘要:#账号和密码#必须包含字母和数字,长度在6-12之间#密码,必须包含大小写字母、数字、特殊符号,长度在8-12之间#输入几,就产生几条,并且用户名不能重复 import string,randomnumber = input("请输入生成的条数:").strip()# print(type(numb 阅读全文
posted @ 2021-01-12 15:11 术成 阅读(973) 评论(0) 推荐(0)
摘要:# nginx日志监控系统# 数据来源为: nginx的access.log# 当某一个ip出现次数超过50次以后# 报警 xxxx 地址,已经访问超过50次 print# 运行频率,每分钟运行一次 # 1、读取文件(I/O操作) open(access.log)# 2、解析文件,分析出ip# 3、 阅读全文
posted @ 2021-01-01 20:42 术成 阅读(416) 评论(0) 推荐(1)