python
文章平均质量分 50
co_diy
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Python函数参数中的*,**
问题: Python的函数定义中有两种特殊的情况,即出现*,**的形式。 如:def execute_command(self, *args, **options)等。 解释: * 用来传递任意个无名字参数,这些参数会一个Tuple的形式访问。 **用来处理传递任意个有名字的参数,这些参数用dict来访问。 应用: #############转载 2011-12-08 14:34:07 · 749 阅读 · 0 评论 -
pyton中类的变量与对象的变量误用
pyton中类的变量与对象的变量误用 昨天在开发tornado服务器时碰到一个奇怪的错误, 客户端第一次连接没问题,第二次就报下面: RuntimeError: Cannot write() after finish(). May be caused by using async operations without the @asynchronous原创 2011-12-13 16:35:18 · 1836 阅读 · 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 · 946 阅读 · 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 · 8304 阅读 · 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 · 3746 阅读 · 0 评论
分享