摘要: dockerfile FROM python:3.8.10 MAINTAINER name taipi@163.com WORKDIR /usr/src/app COPY requirements.txt /usr/src/app RUN pip install -r requirements.tx 阅读全文
posted @ 2022-09-28 16:42 topass123 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 进程池 import multiprocessingimport time# 多进程编程def get_html(n): time.sleep(n) print('sub progress success') return nif __name__ == '__main__': # 使用进程池 po 阅读全文
posted @ 2022-09-28 11:23 topass123 阅读(48) 评论(0) 推荐(0) 编辑
摘要: __init__和__new__ #!/user/bin/env python # -*- coding:utf-8 -*- # __new__ 在 __init__ 之前执行 # __new__ 是用来控制对象的生成过程, 在对象生成之前 # __init__ 是用来完善对象的 # 如果__new 阅读全文
posted @ 2022-09-28 11:06 topass123 阅读(53) 评论(0) 推荐(0) 编辑
摘要: import contextlib import time @contextlib.contextmanager def open(file_name): print('statrt',time.time()) yield print('end time',time.time()) with ope 阅读全文
posted @ 2022-09-28 10:29 topass123 阅读(15) 评论(0) 推荐(0) 编辑
摘要: bisect是python内置模块,用于有序序列的插入和查找。 查找: bisect(array, item) 插入: insort(array,item) import bisect a = [1,4,6,8,12,15,20] position = bisect.bisect(a,13) #由于 阅读全文
posted @ 2022-09-28 10:11 topass123 阅读(14) 评论(0) 推荐(0) 编辑