python怎么查看函数有什么参数

如题所述

第1个回答  2016-06-12

由于Python语言的动态类型特性,在集成开发环境或编辑工具编码时,给予的代码提示及自动完成功能不象静态语言工具(比如使用VisualStudio开发C#)那样充分。


实现开发过程中,我们借助于相关插件或使用Python内置函数"help()”来查看某个函数的参数说明,以查看内置函数sorted()为例:

>>> help(sorted)
Help on built-in function sorted in module builtins:

sorted(iterable, key=None, reverse=False)
    Return a new list containing all items from the iterable in ascending order.

    A custom key function can be supplied to customise the sort order, and the
    reverse flag can be set to request the result in descending order.

>>>

相似回答