04 2020 档案

摘要:import os from multiprocessing import Pool demo = 'this is a test' def func(): with open('text.txt', 'w') as f: f.write(demo) print('process {} write 阅读全文
posted @ 2020-04-19 23:57 疯狂列表推导式 阅读(114) 评论(0) 推荐(0) 编辑
摘要:```https://blog.csdn.net/cpongo3/article/details/88819885``` 阅读全文
posted @ 2020-04-19 19:18 疯狂列表推导式 阅读(130) 评论(0) 推荐(0) 编辑
摘要:``` # -*- coding: utf-8 -*- ''' @File : test.py @Author: qiguagnhui @Date : 2020-04-11 23:17 @Desc : ''' import os import sys savedStdout = sys.stdout #保存标准输出流 with open('out.txt', 'w') as file: sys.s 阅读全文
posted @ 2020-04-16 23:52 疯狂列表推导式 阅读(136) 评论(0) 推荐(0) 编辑
摘要:# -*- encoding=utf-8 -*- from itertools import combinations,permutations test_data = {'a', 'b', 'c'} # 排列 -- 关注排列方式 print('排列有:{}'.format(list(permuta 阅读全文
posted @ 2020-04-13 08:20 疯狂列表推导式 阅读(279) 评论(0) 推荐(0) 编辑
摘要:``` # 第一种: number = 11223344556677889900 # 反转1,reverse()方法 # list1 = list(str(number)) # list1.reverse() # 反转2, 切片 list1 = list(str(number))[::-1] print('反转后的', list1) # 删除 # 删除1, 直接remove元素 list1.rem 阅读全文
posted @ 2020-04-13 08:12 疯狂列表推导式 阅读(301) 评论(0) 推荐(0) 编辑
摘要:``` # -*- coding: utf-8 -*- import cv2 # 读取图片 img = cv2.imread('phone.png') # h、w为想要截取的图片大小 h = 35 w = 170 x = 500 y = 425 cropImg = img[(y):(y + h), (x):(x + w)] cv2.imwrite('test.png', cropImg) ``` 阅读全文
posted @ 2020-04-13 06:52 疯狂列表推导式 阅读(107) 评论(0) 推荐(0) 编辑
摘要:``` # -*- coding: utf-8 -*- # 获取server运行情况 # import json # from datetime import datetime # # import paramiko # import xlwt, xlrd # from xlutils.copy import copy # # def get_host_cpu_memory(): # client 阅读全文
posted @ 2020-04-12 18:27 疯狂列表推导式 阅读(251) 评论(0) 推荐(0) 编辑
摘要:``` import time from multiprocessing import Process start_time = time.time() def get_data(): while True: time.sleep(2) print('休眠2秒钟') def jisuan(): print('开始计算,用时10秒') time.sleep(10) print('结束计算,用时10秒 阅读全文
posted @ 2020-04-11 21:38 疯狂列表推导式 阅读(113) 评论(0) 推荐(0) 编辑
摘要:psutil 模块 import psutil # 逻辑核心 cpu_no = psutil.cpu_count() # 8 # 物理核心 cpu_rel_no = psutil.cpu_count(logical=False) # 4 # 统计CPU的用户/系统/空闲时间 cpu_time = p 阅读全文
posted @ 2020-04-10 22:18 疯狂列表推导式 阅读(99) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示