Chinaunix首页 | 论坛 | 博客
  • 博客访问: 102677
  • 博文数量: 23
  • 博客积分: 555
  • 博客等级: 中士
  • 技术积分: 320
  • 用 户 组: 普通用户
  • 注册时间: 2011-11-14 11:04
文章分类

全部博文(23)

文章存档

2012年(23)

我的朋友

分类: Python/Ruby

2012-04-06 19:42:32

Let's enjoy python. 

0,键入python以得到Python的提示符>>>。键入如下命令:

  1. import this # 获取彩蛋
  2. help
  3. help()
1,>>>提示符依次键入如下命令阅读结果:

  1. help(object)
  2. help(object.__init__)
  3. help(type# help(type(0)) help(type('a')
  4. help(bool) # help(None)
  5. help(int)  # help(long) help(floathelp(complex) 
  6. help(str)  # help(basestringhelp(unicode)
  7. help(len)  # help(str.count) help(str.count())
  8. help(tuple)# help(list) help(dict)
  9. help(file)
2,>>>进一步的,键入如下命令:(注意help()中加引号与不加引号的区别,try it)

  1. help(raw_input)
  2. help(raw_input())
  3. help("import")
  4. help("if")
  5. help("pass")
  6. help("+")
  7. help("[")
  8. help("def")
  9. help("lambda")
  10. help("re")
  11. help("class")
  12. help(Exception)
  13. help("__builtin__")
  14. help("modules")
  15. help("socket")
  16. help("pdb")
  17. help(raw_input)      # help("modules")之后,与上述结果不同
  18. help(raw_input())    # help("modules")之后,跳出个help对话框,Win32下
  19. import re
  20. help(re.match)
/* 不同的结果如下: */
  1. >>>help(raw_input)

  2. Help on function Win32RawInput in module pywin.framework.app:
  3. Win32RawInput(prompt=None)
  4.     Provide raw_input() for gui apps

最后添加一个小段子提醒思考:

  1. tuple = (12, 12, 12, 12)
  2. print "%c %o %d %x" % tuple

阅读(786) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~