学以致用

focus on Python , C++, and some interest in Go and R

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

2011年6月14日

摘要: import inspectdef get_current_function_name(): return inspect.stack()[1][3]class MyClass: def function_one(self): print "%s.%s invoked"%(self.__class__.__name__, get_current_function_name())if __name__ == "__main__": myclass = MyClass() myclass.function_one()动态获取当前运行的函数名很方便,特别是对于 阅读全文
posted @ 2011-06-14 15:10 Jerry.Kwan 阅读(20050) 评论(0) 推荐(1) 编辑

摘要: kill -9 `ps -ef|grep “processname” | grep -v "grep"|awk '{print $2} '`其中processname就要要kill的进程名 阅读全文
posted @ 2011-06-14 11:30 Jerry.Kwan 阅读(1489) 评论(0) 推荐(0) 编辑