上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页
摘要: import time from threading import Thread class worker(Thread): def run(self): for x in xrange(0,11): print x time.sleep(1) class waiter(Thread): def run(self... 阅读全文
posted @ 2019-02-28 10:08 凯文队长 阅读(1096) 评论(0) 推荐(0) 编辑
摘要: 针对Cpython所拥有的GIL锁作用:由于Cpython解释器在运行python文件时, Cpython进程与其运行文件所产生的主进程是一个进程(文件进程相当于Cpython的一个线程) 线程的特点是数据资源是共享的,而多个线程又都要共享Cpython的解释权限,共享意味着竞争,有竞争数据就不安全 阅读全文
posted @ 2019-02-27 17:17 凯文队长 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 线程有2种调用方式,如下: 直接调用 继承式调用 同步锁(py2版本) *注:不要在3.x上运行,不知为什么,3.x上的结果总是正确的,可能是自动加了锁 死锁 所谓死锁:是指两个或两个以上的进程或线程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去。此时称系统处 阅读全文
posted @ 2019-02-27 17:11 凯文队长 阅读(1013) 评论(0) 推荐(0) 编辑
摘要: 格式一:装饰器外层不传参,内层传参 user:alexpassword:abc!23welcome login....henan********,henan args 格式一:装饰器外层传参,内层传参 user:alexpasword:abc!23welcome login....henan**** 阅读全文
posted @ 2019-02-27 10:38 凯文队长 阅读(436) 评论(0) 推荐(0) 编辑
摘要: 在python中,存在2种循环方式:for循环和while循环。 while循环的实现很简单, 其本质就是一个条件语句,自定义条件,当条件满足的时候,不断执行while代码块。 但是for循环,究竟是怎么回事呢?说到for循环,那么就不能不讲到迭代了 迭代 python中迭代对象分2种:迭代器对象( 阅读全文
posted @ 2019-02-26 18:16 凯文队长 阅读(1253) 评论(0) 推荐(0) 编辑
摘要: GIL机制导致如下结果: 1、线性模式测试 ('thread cpu ', 102.20300006866455)('thread IO ', 654.5730001926422)('Thread Http Request', 21.170999765396118) 3.进程模式测试 ('Multi 阅读全文
posted @ 2019-02-26 14:43 凯文队长 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 优点 相关概念 1、可迭代对象 只有iter() 方法,例如 2、迭代器 迭代器具有iter() 和 next()方法的对象. 你可能会问,为什么list、dict、str等数据类型不是Iterator? 这是因为Python的Iterator对象表示的是一个数据流,Iterator对象可以被nex 阅读全文
posted @ 2019-02-26 09:43 凯文队长 阅读(740) 评论(0) 推荐(0) 编辑
摘要: 环境 手动安装pip install mysqlclient 报错: _mysql.c(29) : fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory no module named My 阅读全文
posted @ 2019-02-25 16:14 凯文队长 阅读(466) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/orrz/p/5456247.html 1:下载安装包,等待等待的过程,OK,在短暂的等待后,下载完成,解压先,简单起见,解压到D盘吧,D:\mysql-5.7.12-winx64 这里可以设置环境变量了(这个不会网上查查),把D:\mysql-5.7 阅读全文
posted @ 2019-02-25 14:46 凯文队长 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 下载地址http://mirrors.sohu.com/mysql/MySQL-5.7/ 1、 wget -c http://mirrors.sohu.com/mysql/MySQL-5.7/MySQL-server-5.7.23-1.sles11.x86_64.rpm wget -c http:/ 阅读全文
posted @ 2019-02-25 11:45 凯文队长 阅读(2122) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页