
Python
文章平均质量分 52
程序NM的猿
这个作者很懒,什么都没留下…
展开
-
Python3之logging按天分割+控制台根据日志级别颜色区分
调用案例,不多说上代码,相关说明都在注释了import timeimport LoggerConfigimport logging#定义日志文件名称和日志级别loggerall = logging.getLogger('logs/all.log')LoggerConfig.configure_logging(logging.DEBUG, 'logs/all.log', 'midnight', 10, 2)loggererror = logging.getLogger('logs/erro原创 2020-11-26 01:49:08 · 1225 阅读 · 2 评论 -
elasticsearch之python案例
新增记录bulkimport timefrom elasticsearch import Elasticsearchfrom elasticsearch import helpersimport configes = Nonedef init(): global es es = Elasticsearch([config.ES_HOST], port=config.ES_PORT)def addRecord(): print("<======start ad原创 2020-09-01 19:32:06 · 368 阅读 · 0 评论 -
Python3模拟TCP客户端发送和接收消息,端口自动重连
# coding:utf-8import randomimport socketimport timeimport threadinghost='127.0.0.1'port=20001count_send = 1;count_recv=1;count_conn=1;def handle_client_send(clientsocket): global count_send try: while True: send='...原创 2020-07-16 12:07:07 · 1118 阅读 · 0 评论