Reading python documentation in the terminal?

后端 未结 6 751
谎友^
谎友^ 2020-12-30 12:14

Is there a way to install the python documentation that would make it available as if it was a manpage? (I know you can download the sourcefiles for the documentation and re

6条回答
  •  孤城傲影
    2020-12-30 12:55

    It's not an exact copy of the documentation, but there's the builtin help() function.

    In an interactive python session, you just call help(whatever_you_want_to_read_about), for example:

    >>> help(all)
    Help on built-in function all in module builtins:
    
    all(...)
        all(iterable) -> bool
    
        Return True if bool(x) is True for all values x in the iterable.
        If the iterable is empty, return True.
    

    Alternatively, you can start an interactive help session like this:

    C:\Users\Rawing>python -c "help()"
    
    Welcome to Python 3.4!  This is the interactive help utility.
    
    help>
    

    And then just type the function/class/module you want to know about:

    help> all
    Help on built-in function all in module builtins:
    
    all(...)
        all(iterable) -> bool
    
        Return True if bool(x) is True for all values x in the iterable.
        If the iterable is empty, return True.
    

提交回复
热议问题