博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

文章分类 -  python

摘要:https://www.zhihu.com/question/20152384 >>> print '' or 5 or 05>>> print 5 and 44>>> print '' or 5 or 0 and 45 对python而言 其一, 在不加括号时候, and优先级大于or 其二, x 阅读全文

posted @ 2018-07-04 13:09 bw_0927 阅读(467) 评论(0) 推荐(0)

摘要:https://bitmingw.com/2018/05/06/get-ip-address-of-network-interface-in-python/ 在 StackOverflow 上流传着这样一份用 Python 获取网卡 IPv4 地址的神秘代码。 网卡名字可以从/sys/class/n 阅读全文

posted @ 2018-06-15 15:57 bw_0927 阅读(8836) 评论(0) 推荐(1)

摘要:http://kuanghy.github.io/2016/10/15/encoding-python2-vs-python3 在 Python 中,不论是 Python2 还是 Python3 中,总体上说,字符都只有两大类: 通用的 Unicode 字符; (unicode 被编码后的)某种编码 阅读全文

posted @ 2018-06-15 15:36 bw_0927 阅读(1785) 评论(1) 推荐(1)

摘要:http://python.jobbole.com/88291/ https://www.cnblogs.com/my_life/articles/9075758.html Tornado、Twisted、Gevent 这类异步框架 Flask、Django等传统的非异步框架 深入学习Python3 阅读全文

posted @ 2018-06-12 11:28 bw_0927 阅读(202) 评论(0) 推荐(0)

摘要:https://juejin.im/entry/577ce6322e958a00549c7cab 安装: curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash 阅读全文

posted @ 2018-06-11 21:39 bw_0927 阅读(1149) 评论(0) 推荐(0)

摘要:http://www.woola.net/detail/2016-10-18-python-coprocessor.html http://senlinzhan.github.io/2016/07/30/Python%E5%8D%8F%E7%A8%8B%E7%9A%84%E5%89%8D%E4%B8 阅读全文

posted @ 2018-05-25 10:50 bw_0927 阅读(382) 评论(0) 推荐(0)

摘要:http://python.jobbole.com/88291/ http://www.cnblogs.com/my_life/articles/5036842.html http://www.cnblogs.com/my_life/articles/7802958.html http://www. 阅读全文

posted @ 2018-05-23 10:51 bw_0927 阅读(455) 评论(0) 推荐(0)

摘要:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001432712108300322c61f256c74803b43bfd65c6f8d0d0000 在开发Python应用程序的时 阅读全文

posted @ 2018-01-26 16:50 bw_0927 阅读(137) 评论(0) 推荐(0)

摘要:http://blog.csdn.net/wudj810818/article/details/50518511 一些语言(如Java)的三元表达式形如: 判定条件 ? 为真时的结果 : 为假时的结果 判定条件 ? 为真时的结果 : 为假时的结果 判定条件 ? 为真时的结果 : 为假时的结果 判定条 阅读全文

posted @ 2017-12-19 18:07 bw_0927 阅读(1819) 评论(0) 推荐(0)

摘要:http://blog.gusibi.com/post/python-concurrency-with-futures/ https://www.cnblogs.com/zhaof/p/7679529.html 从Python3.4起,标准库中有两个为Future的类:concurrent.futu 阅读全文

posted @ 2017-11-08 10:56 bw_0927 阅读(626) 评论(0) 推荐(0)

摘要:https://www.ziwenxie.site/2016/12/19/python-asyncio/ ython社区虽然对于异步编程的支持相比其他语言稍显迟缓,但是也在Python3.4中加入了asyncio,在Python3.5上又提供了async/await语法层面的支持,刚正式发布的Pyt 阅读全文

posted @ 2017-11-07 15:04 bw_0927 阅读(571) 评论(0) 推荐(0)

摘要:tornado.concurrent.Future is similar to concurrent.futures.Future, but not thread-safe (and therefore faster for use with single-threaded event loops) 阅读全文

posted @ 2017-11-07 11:41 bw_0927 阅读(448) 评论(0) 推荐(0)

摘要:http://strawhatfy.github.io/2015/12/10/ProcessPoolExecutor_In_Tornado/ 编程时遇到的阻塞任务一般有两类: 由于 Tornado 工作模型的原因,通过异步库(指由系统级非阻塞 I/O 来提供支持的库)来处理 I/O 密集型操作才是 阅读全文

posted @ 2017-11-07 11:19 bw_0927 阅读(1344) 评论(0) 推荐(0)

摘要:什么是Coroutine? Coroutine,又称作协程。从字面上来理解,即协同运行的例程,它是比是线程(thread)更细量级的用户态线程,特点是允许用户的主动调用和主动退出,挂起当前的例程然后返回值或去执行其他任务,接着返回原来停下的点继续执行。等下,这是否有点奇怪?我们都知道一般函数都是线性 阅读全文

posted @ 2017-11-06 14:33 bw_0927 阅读(148) 评论(0) 推荐(0)

摘要:http://tornado-zh.readthedocs.io/zh/latest/guide/coroutines.html Tornado中推荐使用 协程 写异步代码. 协程使用了Python的 yield 关键字代替链式回调来将程序挂起和恢复执行 使用协程几乎像写同步代码一样简单, 并且不需 阅读全文

posted @ 2017-11-03 18:16 bw_0927 阅读(236) 评论(0) 推荐(0)

摘要:http://strawhatfy.github.io/2015/07/22/Tornado.gen/ tornado.gen 模块是一个基于 python generator 实现的异步编程接口。 通常我们编写的异步代码如下: 而使用 tornado.gen 模块提供的 decorator ,在 阅读全文

posted @ 2017-10-27 18:20 bw_0927 阅读(501) 评论(0) 推荐(0)

摘要:https://blog.alswl.com/2013/11/python-gdb/ http://www.jianshu.com/p/d150563f49a3 有一些类型的 bugs 很难使用 Python 直接进行 debug,比如 段错误(无法被捕捉的 Python 异常) 卡住的进程(这种情 阅读全文

posted @ 2017-10-25 18:05 bw_0927 阅读(854) 评论(0) 推荐(0)

摘要:web模块里面最常用的RequestHandler类,通常我们自己的Handler都是继承它。 methods HTTP常用方法 Tornado里面默认支持 GET,HEAD,POST,DELETE,PATCH,PUT,OPTIONS方法,如果您还需要其他方法,可以子类中重写 SUPPORTED_M 阅读全文

posted @ 2017-10-24 18:38 bw_0927 阅读(233) 评论(0) 推荐(0)

摘要:https://weilaihui.gitbooks.io/tornado-web/content/module/index.html http://www.cnblogs.com/shijingjing07/tag/tornado/ https://www.kancloud.cn/kancloud 阅读全文

posted @ 2017-10-24 18:31 bw_0927 阅读(451) 评论(0) 推荐(0)

摘要:http://www.jianshu.com/p/3cc234198567 HTTP 持久连接 HTTP通信中,client和server一问一答的方式。HTTP是基于TCP的应用层协议,通常在发送请求之前需要创建TCP连接,然后在收到响应之后会断开这个TCP连接。这就是常见的http短连接。既然有 阅读全文

posted @ 2017-10-24 16:35 bw_0927 阅读(303) 评论(0) 推荐(0)