- 博客(4)
- 收藏
- 关注
原创 在一个函数中如何知道调用者(Python)
在一个函数中 def fun():pass 这个函数如何知道是谁调用了它呢? 在C类语言中好像是很难的。但在 Python中却很简单 import tracebackdef fun(): s = traceback.extract_stack() print %s Invoked me!%s[-2][2]这个 fun 函数就可以知道是谁调用了它,
2004-09-04 18:27:00
2968
原创 在 Python中使用 cout << 'Hello,world!' << endl
import sysclass ostream: def __init__(self,file): self.file = file def __lshift__(self,obj): self.file.write(str(obj)); return selfcout = ostream(sys.stdout)cerr = ost
2004-09-03 16:07:00
2350
2
原创 The Python Paradox - Paul Graham
In a recent talk I said something that upset a lot of people: that you could get smarter programmers to work on a Python project than you could to work on a Java project.I didnt mean by this that Jav
2004-09-03 14:22:00
1236
原创 使用 python 破除网页限制
昨天找到一个比较好的人工智能网站, 其中有一些很不错的 prolog 文章,我很感兴趣。文中有很多示例程序,可是网页的右键被禁止了,也不能选择,不能保存,不能察看源代码!! 实在不爽,信息本来就要共享嘛! 只好发扬下 hack 精神,冲破限制。还好,有 python 方便多了。 网页中增加限制,无非是在 html 中设置脚本,既然浏览
2004-09-01 10:59:00
1955
4
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人