上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 71 下一页
摘要: """设计场景:timo先说一句,亚索再说一句timo: timo队长正在待命yasuo: 面对疾风吧timo: timo整装待发yasuo: 哈杀gay """我们最先想到就是使用Lock一人轮流说一句,看下效果: 实际下效果发现好像不一样: 那么如何控制他们按照合理的顺序去你说一句我回答一局好像 阅读全文
posted @ 2020-02-15 20:22 不带R的墨菲特 阅读(350) 评论(0) 推荐(0)
摘要: 锁的引入: 我们查看官方文档:https://docs.python.org/3/library/threading.html#lock-objects 原语锁:threading.Lock 实现原始锁对象的类。一旦线程获取了锁,随后的尝试将其阻塞,直到释放为止。任何线程都可以释放它。 重入锁:th 阅读全文
posted @ 2020-02-15 19:26 不带R的墨菲特 阅读(404) 评论(0) 推荐(0)
摘要: 1.认识GIL: 说到GIL一直是代码专家们一直以来想要解决的问题,也是被许多程序员诟病的,下面带领大家看下官方threading模块document中如何去描述对于GIL这个全局解释器锁的:https://docs.python.org/3/library/threading.html 全局解释器 阅读全文
posted @ 2020-02-15 02:22 不带R的墨菲特 阅读(959) 评论(0) 推荐(0)
摘要: 查看源码: 这是一个线程控制的类,这个类可以被子类化(继承)在一定的条件限制下,这里有两种方式去明确活动:第一通过传入一个callable 对象也就是调用对象,一种是通过重写这个Thread类的run方法 def add(): pass print(callable(add))从的上面实现多线程方式 阅读全文
posted @ 2020-02-14 20:28 不带R的墨菲特 阅读(643) 评论(0) 推荐(0)
摘要: python 实现threadpool线程池管理: from concurrent.futures import ThreadPoolExecutor as te from concurrent.futures import ProcessPoolExecutor as pe from concur 阅读全文
posted @ 2020-02-13 20:53 不带R的墨菲特 阅读(227) 评论(0) 推荐(0)
摘要: from locust import HttpLocust, TaskSet, task import uuid, time import logging,json # https://docs.locust.io/en/stable/third-party-tools.html class Use 阅读全文
posted @ 2020-02-13 19:30 不带R的墨菲特 阅读(228) 评论(0) 推荐(0)
摘要: # coding=utf-8 # urllib_get_file=urllib.request.urlretrieve(url=None,filename="test.zip") # basic usage of urllib from urllib import request url = "ht 阅读全文
posted @ 2020-02-13 00:23 不带R的墨菲特 阅读(139) 评论(0) 推荐(0)
摘要: 核心代码: for i in range(10): print('\r' + '>' * i, end='') 示例展示以搜狗输入法为例: import timeimport requestsimport osfor i in range(10): print('\r' + '>' * i, end 阅读全文
posted @ 2020-02-12 18:19 不带R的墨菲特 阅读(331) 评论(0) 推荐(0)
摘要: 修改服务器源,避免长途跋涉到国外: 位置: vim /etc/yum.repos.d/CentOS-Base.repo aliyun地址: 设置aliyun的yum源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.co 阅读全文
posted @ 2020-02-12 17:34 不带R的墨菲特 阅读(334) 评论(0) 推荐(0)
摘要: 使用过Ubuntu的道友们都知道,默认地址是乌班图的org 配置的,对于国内长途跋涉的各位高手来讲真是艰辛; 所以我们一般在安装的时候会先修改服务器源地址使用国内的比如ali,清华或者华为的 源文件地址默认在 /etc/apt/sources.list,当然如果你安装第三方的一般我们喜欢在/etc/ 阅读全文
posted @ 2020-02-12 17:22 不带R的墨菲特 阅读(869) 评论(0) 推荐(0)
上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 71 下一页