![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 50
co_diy
这个作者很懒,什么都没留下…
展开
-
Python函数参数中的*,**
问题: Python的函数定义中有两种特殊的情况,即出现*,**的形式。 如:def execute_command(self, *args, **options)等。解释: * 用来传递任意个无名字参数,这些参数会一个Tuple的形式访问。 **用来处理传递任意个有名字的参数,这些参数用dict来访问。应用:#############转载 2011-12-08 14:34:07 · 696 阅读 · 0 评论 -
pyton中类的变量与对象的变量误用
pyton中类的变量与对象的变量误用 昨天在开发tornado服务器时碰到一个奇怪的错误,客户端第一次连接没问题,第二次就报下面:RuntimeError: Cannot write() after finish(). May becaused by using async operations withoutthe @asynchronous原创 2011-12-13 16:35:18 · 1755 阅读 · 0 评论 -
python调用c的方法
python调用c的方法研究了三天,今天看了一篇博客原来这么简单,可能是最简单的方法了吧。下面整理一下思路实验平台:window xp系统,编译环境是vs2005实验步骤:步骤1:在vs2005下编写c模块代码如下#include #include #include //#include "Python.h"_declspec(dll原创 2012-02-07 14:28:05 · 855 阅读 · 0 评论 -
python打印log调试信息的方法
打印错误跟踪的方法:方法1.打印到屏幕try: i = 0 mydbhandler.executemany(sql, tmp) logging.info("[total cost time:" + str((time.time() - start)*1000) + "ms]") print "total cost time:", (time.ti原创 2012-02-08 15:54:31 · 8171 阅读 · 0 评论 -
pydev导入扩展模块出现红叉
今天编译了一个c扩展模块,然后把模块拷到python的库目录(D:\Program Files\python2_7\DLLs)下,导入到系统时出现红叉,不过奇怪的是可以调用,所以查了一下。原来是要把库重新加载一下。具体方法有两种:方法1.进入Windows->Preferences->Pydev->Interpreter – Python菜单,转到Forced Builtins页N原创 2012-02-10 17:54:44 · 3670 阅读 · 0 评论