上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 71 下一页
摘要: import queue import time import random import threading import asyncio import logging logging.basicConfig(level = logging.INFO,format = '%(asctime)s - 阅读全文
posted @ 2019-12-17 12:42 不带R的墨菲特 阅读(1345) 评论(0) 推荐(0)
摘要: class concurrent.futures.Executor Executor是一个抽象类,它提供了异步执行调用的方法。它不能直接使用,但可以通过它的两个子类ThreadPoolExecutor或者ProcessPoolExecutor进行调用。 我们可以将相应的tasks直接放入线程池/进程 阅读全文
posted @ 2019-12-14 12:25 不带R的墨菲特 阅读(787) 评论(0) 推荐(0)
摘要: 协程通过 async/await 语法进行声明,是编写异步应用的推荐方式 例如新定义一个协程(coroutine object): async def foo(): return 42 首先先来介绍下: 认识aysn和asyncio都有哪些函数方法: 创建一个future 对象: task = as 阅读全文
posted @ 2019-12-13 19:10 不带R的墨菲特 阅读(1420) 评论(1) 推荐(0)
摘要: df -h 查看磁盘使用有一个vdb满了 df -i 查看inode 使用率 显示文件大小: du -sh /* du参数: -a : 列出所有的文件与目录容量,因为默认仅统计目录下面的文件量而已; -h : 以人们较易读的容量格式(G/M)显示; -s : 列出总量,而不列出每个个别的目录占用了容 阅读全文
posted @ 2019-12-13 12:34 不带R的墨菲特 阅读(767) 评论(0) 推荐(0)
摘要: import timeimport datetimeimport operatordef makeStamp(y,m,d,format='%Y-%m-%d'): """make timestamp from date """ date_tuple=str(datetime.date(y, m, d) 阅读全文
posted @ 2019-12-12 19:03 不带R的墨菲特 阅读(687) 评论(0) 推荐(0)
摘要: import yaml import json import csv import configparser class IoUtils(object): """ dependency: pip install pyyaml yaml_r: read yaml ,return dict yaml_w 阅读全文
posted @ 2019-12-12 19:01 不带R的墨菲特 阅读(259) 评论(0) 推荐(0)
摘要: logging模块是Python内置的标准模块,主要用于输出运行日志,可以设置输出日志的等级、日志保存路径、日志文件回滚等。 相比print,具备如下优点: 可以通过设置不同的日志等级,在release版本中只输出重要信息,而不必显示大量的调试信息;print将所有信息都输出到标准输出中,严重影响开 阅读全文
posted @ 2019-12-12 18:55 不带R的墨菲特 阅读(301) 评论(0) 推荐(0)
摘要: 处理multipart/form-data 的java serverlet请求接口通过python实现 记住不要在头加:"Content-Type":"multipart/form-data"不然会报错 import requestsdt={"file":{},"message": "duotou" 阅读全文
posted @ 2019-11-29 14:21 不带R的墨菲特 阅读(2560) 评论(0) 推荐(1)
摘要: import threading lock = threading.Lock()def th_001(req): lock.acquire() print(req,time.asctime()) lock.release()def test(): pool=[] for i in range(100 阅读全文
posted @ 2019-11-22 16:13 不带R的墨菲特 阅读(123) 评论(0) 推荐(0)
摘要: import argparse,osdata_func=["upload","download"]req_func=["getfunc","postfunc"]def func1(): print("this func1")def func2(): print("this is func2")par 阅读全文
posted @ 2019-11-22 16:09 不带R的墨菲特 阅读(246) 评论(0) 推荐(0)
上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 71 下一页