Python中help() 与 dir()

来源:互联网 发布:高铁 刘志军 知乎 编辑:程序博客网 时间:2024/06/07 03:51

在Python中行走的拐杖:help() 与 dir()

1. 

Python v2.7.1 documentation » The Python Standard Library »

  • 2. Built-in Functions
找到help()

help([object])

Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

This function is added to the built-in namespace by the site module.

New in version 2.2.


>>>help(dir) 即可

2. dir()

>>>import copy

>>>[n for n in dir(copy) if not n.startswith('_')]

     
  • Python v2.7.1 documentation » 
  • The Python Standard Library »
     
  • Python v2.7.1 documentation » 
  • The Python Standard Library »







0 0
原创粉丝点击