python: how to get information about a function?

后端 未结 4 1707
北荒
北荒 2020-11-29 03:50

When information about a type is needed you can use:

my_list = []
dir(my_list)

gets:

[\'__add__\', \'__class__\', \'__conta         


        
4条回答
  •  春和景丽
    2020-11-29 04:26

    You can use pydoc.

    Open your terminal and type python -m pydoc list.append

    The advantage of pydoc over help() is that you do not have to import a module to look at its help text. For instance python -m pydoc random.randint.

    Also you can start an HTTP server to interactively browse documentation by typing python -m pydoc -b (python 3)

    For more information python -m pydoc

提交回复
热议问题