![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
A_Prophet
这个作者很懒,什么都没留下…
展开
-
python datetime 和时间戳互转
import datetime, timenow = datetime.datetime.now()now_time = int(time.mktime(now.timetuple())) #datetime 转时间戳now = datetime.datetime.fromtimestamp(now_time) #时间戳转datetime# datetime 当天8点d...原创 2018-10-11 14:28:31 · 32427 阅读 · 1 评论 -
python 类排序
a1={'a':1, 'b':3}a2={'a': 2, 'b': 2}a3={'a':3,'b':1}aa=[a1,a2,a3]v = sorted(aa,cmp = lambda x,y: cmp(x['b'],y['b']))原创 2018-10-15 16:37:58 · 2609 阅读 · 0 评论 -
python 最容易理解的多进程demo
创建一个简单的多进程任务只需要5步:1.创建任务的函数,准备多线程调用2.创建进程池,并指定进程池中线程的个数3. 进程池调用步骤1创建的函数,开启进程运行任务 4.关闭进程池 pool.close()5.判断是否需要等待所有进程结束再运行主函数pool.join()# coding=utf-8from multiprocessing import Process, P...原创 2018-11-30 16:55:39 · 334 阅读 · 0 评论