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

文章分类 -  python

摘要:https://piaosanlang.gitbooks.io/faq/tornado/tornadoyi-bu-bi-ji-ff08-er-ff09-yi-bu-ke-hu-duan-asynchttpclient.html 几种不同的异步接口的开发方式: 回调参数(Callback argume 阅读全文

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

摘要:https://piaosanlang.gitbooks.io/faq/tornado/tornadoyi-bu-bi-ji-ff08-yi-ff09-yi-bu-ren-wu.html https://piaosanlang.gitbooks.io/faq/tornado/tornadoyuan- 阅读全文

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

摘要:https://www.kancloud.cn/digest/learnpython/217656 目录遍历 包: os os.path 函数: os.listdir(dirname):列出dirname下的目录和文件 os.getcwd():获得当前工作目录 os.curdir:返回当前目录('. 阅读全文

posted @ 2017-10-24 14:51 bw_0927 阅读(432) 评论(0) 推荐(0)

摘要:python的set和其他语言类似, 是一个无序不重复元素集, 基本功能包括关系测试和消除重复元素. 集合对象还支持union(联合), intersection(交), difference(差)和sysmmetric difference(对称差集)等数学运算. x = set()Tuple 固 阅读全文

posted @ 2017-10-20 16:42 bw_0927 阅读(144) 评论(0) 推荐(0)

摘要:Python进行URL解码 import urllib rawurl=xxx url=urllib.unquote(rawurl) 所用模块:urllib 所用函数:urllib.unquote() 案例 import urllib rawurl = "%E6%B2%B3%E6%BA%90" url 阅读全文

posted @ 2017-09-29 15:26 bw_0927 阅读(1970) 评论(0) 推荐(0)

摘要:http://blog.csdn.net/jianhong1990/article/details/26370519 http://yunjianfei.iteye.com/blog/2061756 http://zhou123.blog.51cto.com/4355617/1650185 http 阅读全文

posted @ 2017-09-27 17:35 bw_0927 阅读(6100) 评论(0) 推荐(0)

摘要:http://blog.csdn.net/my2010sam/article/details/17735159 总结: 内部函数,不修改全局变量可以访问全局变量 内部函数,修改同名全局变量,则python会认为它是一个局部变量 在内部函数修改同名全局变量之前调用变量名称(如print sum),则引 阅读全文

posted @ 2017-09-27 16:22 bw_0927 阅读(297) 评论(0) 推荐(0)

摘要:http://www.cnblogs.com/stubborn412/p/3818423.html http://www.cnblogs.com/my_life/articles/7283778.html python一般从数据库中读取的字符串会自动被转换为unicode字符串 Python 有办法 阅读全文

posted @ 2017-09-21 14:33 bw_0927 阅读(163) 评论(0) 推荐(0)

摘要:a = [1, 2, 3, 4, 5, 6, 7, 8, 9] print ','.join(str(x) for x in a) 1,2,3,4,5,6,7,8,9 print ','.join(str(x) for indx,x in enumerate(a) if indx < 5) 1,2, 阅读全文

posted @ 2017-09-19 18:29 bw_0927 阅读(113) 评论(0) 推荐(0)

摘要:http://www.pulpcode.cn/2015/05/09/bug-for-mysql-python-cursor-commit/index.html 场景还原 为了能够清楚的描述这个问题,我们写一个简单的服务,语言使用python,框架使用tornado,数据库使用mysql,数据库连接使 阅读全文

posted @ 2017-09-13 16:25 bw_0927 阅读(395) 评论(0) 推荐(0)

摘要:http://mysql-python.sourceforge.net/MySQLdb.html#cursor-objects http://blog.chinaunix.net/uid-25525723-id-2981174.html http://blog.csdn.net/zhaihaifei 阅读全文

posted @ 2017-09-13 15:41 bw_0927 阅读(150) 评论(0) 推荐(0)

摘要:http://www.cnblogs.com/wangenzhi/p/5895790.html https://blog.linuxeye.cn/334.html Python中,队列是线程间最常用的交换数据的形式。Queue模块是提供队列操作的模块,虽然简单易用,但是不小心的话,还是会出现一些意外 阅读全文

posted @ 2017-09-08 10:04 bw_0927 阅读(103) 评论(0) 推荐(0)

摘要:http://www.cnblogs.com/arkenstone/p/5695161.html 在python的函数中经常能看到输入的参数前面有一个或者两个星号:例如 def foo(param1, *param2): def bar(param1, **param2): 这两种用法其实都是用来将 阅读全文

posted @ 2017-09-08 10:00 bw_0927 阅读(187) 评论(0) 推荐(0)

摘要:json不认单引号,json中的字符串需要用双引号包起来。 { 'a': 1} JSON的key必须是双引号的字符串 JSON 的值可以是: 数字(整数或浮点数) 字符串(在双引号中) 逻辑值(true 或 false) 数组(在中括号中) 对象(在大括号中) null { "a": 1} 正确 h 阅读全文

posted @ 2017-08-04 10:47 bw_0927 阅读(607) 评论(0) 推荐(0)

摘要:http://www.cnblogs.com/frydsh/archive/2012/08/12/2602100.html Python是静态作用域语言,尽管它自身是一个动态语言。也就是说,在Python中变量的作用域是由它在源代码中的位置决定的,这与C有些相似,但是Python与C在作用域方面的差 阅读全文

posted @ 2017-08-02 14:14 bw_0927 阅读(562) 评论(0) 推荐(0)

摘要:http://blog.csdn.net/longshenlmj/article/details/13773977 函数参数传递本质上和变量整体复制一样,只是两个变量分别为形参a和实参b。那么,a=b后,a变了,b值是否跟着变呢?这取决于对象内容可变不可变 首先解释一下,什么是Python对象的内容 阅读全文

posted @ 2017-08-01 16:28 bw_0927 阅读(4302) 评论(0) 推荐(1)

摘要:https://harveyqing.gitbooks.io/python-read-and-write/content/python_advance/python_thread_sync.html 锁通常被用来实现对共享资源的同步访问。为每一个共享资源创建一个Lock对象,当你需要访问该资源时,调 阅读全文

posted @ 2017-07-26 14:50 bw_0927 阅读(247) 评论(0) 推荐(0)

摘要:psutil httplib 阅读全文

posted @ 2017-07-14 14:22 bw_0927 阅读(98) 评论(0) 推荐(0)

摘要:在计算机编程中,自省是指这种能力:检查某些事物以确定它是什么、它知道什么以及它能做什么。自省向程序员提供了极大的灵活性和控制力。 自省(introspection),在计算机编程领域里,是指在运行时来判断一个对象的类型的能力。它是Python的强项之一。Python中所有一切都是一个对象,而且我们可 阅读全文

posted @ 2017-06-30 17:04 bw_0927 阅读(586) 评论(0) 推荐(1)

摘要:http://www.cnblogs.com/my_life/articles/7095349.html 回到刚才的例子 def my_decorator(func): //my_decorator:装饰器, fuc:被装饰的函数 def wrapper(): print "Before the f 阅读全文

posted @ 2017-06-30 16:05 bw_0927 阅读(245) 评论(0) 推荐(0)