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 anexampleof 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
这篇博客介绍了在Python编程中获取帮助的多种方式,包括使用谷歌搜索Python相关问题,查阅官方文档,利用StackOverflow,以及在Python解释器内使用help()和dir()函数。官方Python文档和StackOverflow通常是寻找答案的有效途径,而在Python交互式环境中,help()函数能提供模块、函数和方法的详细文档字符串。

239

被折叠的 条评论
为什么被折叠?



