前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >如何使用Python中的帮助

如何使用Python中的帮助

原创
作者头像
雷大亨
发布2018-01-01 19:58:14
1.7K0
发布2018-01-01 19:58:14
举报
文章被收录于专栏:遊俠扎彪遊俠扎彪

其实学一门新语言,或是接触一个新东西,真的要注意其自带的帮助文档,比如各种manual、内嵌的帮助命令等等,尤其是是在Linux/UNIX领域。

比如学习Python,你在交互式的Python shell中键入help时,会提示:

代码语言:txt
复制
>>> help

Type help() for interactive help, or help(object) for help about object.

那么你如果在意的话,就会很容易了,要么键入help(),要么键入help('modules')之类的。比如:

代码语言:txt
复制
>>> help("keywords")

Here is a list of the Python keywords.  Enter any keyword to get more help.

and                 elif                if                  print

as                  else                import              raise

assert              except              in                  return

break               exec                is                  try

class               finally             lambda              while

continue            for                 not                 with

def                 from                or                  yield

del                 global              pass               

或是键入help()以后也要注意其提示:

代码语言:txt
复制
>>> help()

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out

the tutorial on the Internet at http://docs.python.org/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing

Python programs and using Python modules.  To quit this help utility and

return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",

"keywords", or "topics".  Each module also comes with a one-line summary

of what it does; to list the modules whose summaries contain a given word

such as "spam", type "modules spam".

如果看明白了这段提示,你再继续,就应该是:

代码语言:txt
复制
help> keywords

Here is a list of the Python keywords.  Enter any keyword to get more help.

and                 elif                if                  print

as                  else                import              raise

assert              except              in                  return

break               exec                is                  try

class               finally             lambda              while

continue            for                 not                 with

def                 from                or                  yield

del                 global              pass                

所以,要善于利用这些资源!

收藏于 2011-10-29

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档