Let's enjoy python.
0,键入python以得到Python的提示符>>>。键入如下命令:
- import this # 获取彩蛋
- help
- help()
1,>>>提示符依次键入如下命令阅读结果:
- help(object)
- help(object.__init__)
- help(type) # help(type(0)) help(type('a')
- help(bool) # help(None)
- help(int) # help(long) help(float) help(complex)
- help(str) # help(basestring) help(unicode)
- help(len) # help(str.count) help(str.count())
- help(tuple)# help(list) help(dict)
- help(file)
2,>>>进一步的,键入如下命令:(注意help()中加引号与不加引号的区别,try it)
- help(raw_input)
- help(raw_input())
- help("import")
- help("if")
- help("pass")
- help("+")
- help("[")
- help("def")
- help("lambda")
- help("re")
- help("class")
- help(Exception)
- help("__builtin__")
- help("modules")
- help("socket")
- help("pdb")
- help(raw_input) # help("modules")之后,与上述结果不同
- help(raw_input()) # help("modules")之后,跳出个help对话框,Win32下
- import re
- help(re.match)
/* 不同的结果如下: */
- >>>help(raw_input)
- Help on function Win32RawInput in module pywin.framework.app:
- Win32RawInput(prompt=None)
- Provide raw_input() for gui apps
最后添加一个小段子提醒思考:
- tuple = (12, 12, 12, 12)
- print "%c %o %d %x" % tuple
阅读(826) | 评论(0) | 转发(0) |