Online help and dir
There are a variety ways to get help for Python.
- Do a Google search, starting with the word "python", like "python list" or "python string lowercase". The first hit is often the answer. This technique seems to work better for Python than it does for other languages for some reason.
谷歌搜索,以“python”开头的关键字,例如:“python list” 或者 "python string lowercase",通常来说第一个搜索结果就是你所需要的答案。
- The official Python docs site -- docs.python.org -- has high quality docs. Nonetheless, I often find a Google search of a couple words to be quicker.
官方文档
- There is also an official Tutor mailing list specifically designed for those who are new to Python and/or programming!
官方教程邮件组列表--特别为python新手,编程初学者设定。
- Many questions (and answers) can be found on StackOverflow.
www.stackoverflow.com
- Use the help() [and dir()] functions described below.
用下面说到的内置函数,help() dir()
Inside the Python interpreter, the help() function pulls up documentation strings for various modules, functions, and methods. These doc strings are similar to Java's javadoc. This is one way to get quick access to docs. Here are some ways to call help() from inside the interpreter:
- help(len) -- docs for the built in len function (note here you type "len" not "len()" which would be a call to the function)
- help(sys) -- overview docs for the sys module (must do an "import sys" first)
- dir(sys) -- dir() is like help() but just gives a quick list of the defined symbols
- help(sys.exit) -- docs for the exit() function inside of sys
- help('xyz'.split) -- it turns out that the module "str" contains the built-in string code, but if you did not know that, you can call help() just using an example of the sort of call you mean: here 'xyz'.foo meaning the foo() method that runs on strings
- help(list) -- docs for the built in "list" module
- help(list.append) -- docs for the append() function in the list module
原文地址:https://developers.google.com/edu/python/introduction?hl=ja点击打开链接