上一页 1 ··· 4 5 6 7 8 9 下一页
摘要: import osimport timefrom multiprocessing import Pooldef func(i): print('start func%s'%i,os.getpid()) time.sleep(1) print('end func%s' % i, os.getpid() 阅读全文
posted @ 2019-01-22 15:35 刀锋意志1 阅读(125) 评论(0) 推荐(0) 编辑
摘要: import timeimport randomfrom multiprocessing import Process,Queuedef consumer(q,name): while True: print('\033[31m%s吃了%s\033[0m'%(name,q.get())) # 如果队 阅读全文
posted @ 2019-01-21 00:20 刀锋意志1 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 绿灯亮了car 0 通过了car 1 通过了car 2 通过了红灯亮了car 3 在等待car 4 在等待car 5 在等待car 6 在等待car 7 在等待 阅读全文
posted @ 2019-01-20 23:44 刀锋意志1 阅读(206) 评论(0) 推荐(0) 编辑
摘要: :执行完了****************************** ****************************** :执行完了 阅读全文
posted @ 2019-01-19 22:30 刀锋意志1 阅读(115) 评论(0) 推荐(0) 编辑
摘要: server: import socketimport structimport jsonsk = socket.socket()sk.bind(('127.0.0.1',8989))sk.listen()conn,addr = sk.accept()resv_size = conn.recv(4) 阅读全文
posted @ 2019-01-17 16:23 刀锋意志1 阅读(1596) 评论(0) 推荐(0) 编辑
摘要: import jsonfrom collections import namedtuple # 命名元祖Card = namedtuple('Card','rank suit')c1 = Card(2,'红心')class FranchDeck: ranks = [str(rank) for ran 阅读全文
posted @ 2019-01-12 15:08 刀锋意志1 阅读(396) 评论(0) 推荐(0) 编辑
摘要: @property property修饰的类中的方法,会 变成类的属性,调用的时候不用带括号,按照类属性的方法就能调用 可见在对象的命名空间中,类的__name属性进行了变形,变成了_Teacher__name这样的形式,,虽然知道了他的保密的规则,但是 在平常中使用,不建议用这样的方式调用类的私有 阅读全文
posted @ 2019-01-09 17:13 刀锋意志1 阅读(981) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/Eva-J/articles/7293890.html 阅读目录 楔子 面向过程vs面向对象 初识面向对象 类的相关知识 对象的相关知识 对象之间的交互 类命名空间与对象、实例的命名空间 类的组合用法 初识面向对象小结 面向对象的三大特性 继承 多态 封 阅读全文
posted @ 2019-01-07 15:56 刀锋意志1 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 阅读目录 一 模块 3.1 import 3.2 from ... import... 3.3 把模块当做脚本执行 3.4 模块搜索路径 3.5 编译python文件 二 包 2.2 import 2.3 from ... import ... 2.4 __init__.py文件 2.5 from 阅读全文
posted @ 2019-01-06 15:28 刀锋意志1 阅读(172) 评论(0) 推荐(0) 编辑
摘要: def outer(): a = 1 def inner(): print(a) return inner inn = outer() 内部函数,调用了外部函数的变量 并且在外部函数中,把内部函数当做返回值,返回内部函数的地址 这样,调用外部函数时,接收的变量的值,指向内部函数 而,外部函数中的变量 阅读全文
posted @ 2018-12-30 14:59 刀锋意志1 阅读(83) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 下一页