随笔分类 -  python

摘要:背景 python多线程threading 用得比较多。最近发现另外一个自带库 concurrent 只用几行代码就可以编写出线程池/进程池。 concurrent.futures 模块提供异步执行可调用对象高层接口。 异步执行可以由 ThreadPoolExecutor 使用线程 或由 Proce 阅读全文
posted @ 2022-08-01 15:31 快乐开心的大虾 阅读(556) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- """封装执行shell语句方法"""import subprocessimport osclass Shell: @staticmethod def invoke(cmd): output, errors = subprocess.Popen(cmd 阅读全文
posted @ 2022-02-11 12:00 快乐开心的大虾 阅读(862) 评论(0) 推荐(0)
摘要:# 多维嵌套字典数据 # 目标键名称,嵌套数据,储存变量 def Get_Target_Value(key,dic,tmp_list): """ :param key:目标key值 :param dic:JSON数据 :param tmp_list:储存获取的数据 :return: list """ 阅读全文
posted @ 2021-09-08 11:41 快乐开心的大虾 阅读(373) 评论(0) 推荐(0)
摘要:在工作用,有时候需要用到读取json格式的情况 如下: 1 @用户帐号密码和关系 2 {"username":"12345678901","psw":'123456aaa',"classids":["211088c7c75dbc74e2e64f3c77f63642", "0278832f003754 阅读全文
posted @ 2021-07-23 11:12 快乐开心的大虾 阅读(753) 评论(0) 推荐(0)