python
RichardYSteven
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
用pexpect做交互式的程序
http://www.ibm.com/developerworks/cn/linux/l-cn-pexpect1/ 其中一个ftp的例子是 import os import sys (command_output, exitstatus) = pexpect.run('ls -la', withexitstatus=1) #print "%s, %d" %(command_转载 2011-10-27 21:07:07 · 2600 阅读 · 0 评论 -
python 的 lambda用法
#!/usr/bin/python def f(x): return x*2 res = f(3) print res # lambda arg1, arg2...: g = lambda x: x*2 res = g(4) print res原创 2011-11-18 14:53:41 · 944 阅读 · 0 评论 -
python 中的异常
try ... except 语句 #!/usr/bin/python # Filename: try_except.py import sys try: s = raw_input('Enter something --> ') except EOFError: print '\nWhy did you do an转载 2011-10-29 21:38:39 · 802 阅读 · 0 评论 -
python 教程
http://sebug.net/paper/python/ 定义标准注释 #!/usr/bin/python def func(x): '''Func just print some number. x is a number assigned by you''' print 'x is', x原创 2011-09-14 15:17:39 · 913 阅读 · 0 评论 -
python中的类
http://sebug.net/paper/python/ 最简单的类 #!/usr/bin/python # Filename: simplestclass.py class Person: pass p = Person() print p 构造函数 析构函数 #!/usr/bin/python # Filename:转载 2011-10-29 21:06:20 · 710 阅读 · 0 评论 -
python脚本中 得到 参数
#!/usr/bin/python # Filename: param.py import sys print sys.argv print sys.argv[1:] sys.argv 包含了所有的参数,包括了argv[0]是可执行文件的名字。 sys.argv[1:] 将显示数组1开始的所有的参数。 或者可以用optparse模块来解析复杂的参数 可以参原创 2011-10-27 21:48:28 · 829 阅读 · 0 评论 -
python 和 c 的结合
http://www.codeproject.com/KB/cpp/embedpython_1.aspx 不过没有试成功。segment fault.转载 2011-12-14 13:26:35 · 1134 阅读 · 0 评论 -
python中用pdb 来调试
http://www.vpsee.com/2009/09/debug-python-programwith-pdb/ 1. 启动 pdb script_to_debug parameters 或者 script_to_debug -m pdb parameters 2. 显示代码 list 3. 执行下一行 next 4. 添加断点 break转载 2011-11-01 15:38:32 · 687 阅读 · 0 评论 -
python 中的正则表达式
http://wiki.ubuntu.org.cn/Python%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E6%93%8D%E4%BD%9C%E6%8C%87%E5%8D%97转载 2012-02-12 11:42:05 · 632 阅读 · 0 评论 -
python游戏
http://rene.f0o.com/mywiki/PythonGameProgramming转载 2012-11-15 22:42:23 · 1044 阅读 · 0 评论 -
python中的cPickle用法例子
http://flyfeeling.blogbus.com/logs/64147735.html 在python中,一般可以使用pickle类来进行python对象的序列化,而cPickle提供了一个更快速简单的接口,如python文档所说的:“cPickle -- A faster pickle”。 cPickle可以对任意一种类型的python对象进行序列化操作,比如list,转载 2013-03-20 10:40:44 · 1758 阅读 · 0 评论
分享