<dd id="sga4y"><optgroup id="sga4y"></optgroup></dd>
<nav id="sga4y"><code id="sga4y"></code></nav>
  • <optgroup id="sga4y"></optgroup>
    ???? Python ???
    ??7?? ????
    ???? DocStrings ????

    DocStrings

    Python???????????????????? ???????? ????????????? docstrings ??DocStrings???????????????????????????????????????????????t????????????????????????????§Ö??????????????????????

    ???DocStrings

    ??7.8 ???DocStrings

    #!/usr/bin/python
    # Filename: func_doc.py


    def printMax(x, y):
        '''Prints the maximum of two numbers.

        The two values must be integers.'''

        x = int(x) # convert to integers, if possible
        y = int(y)

        if x > y:
            print x, 'is maximum'
        else:
            print y, 'is maximum'

    printMax(3, 5)
    print printMax.__doc__

    ????????code/func_doc.py??

    ???

    $ python func_doc.py
    5 is maximum
    Prints the maximum of two numbers.

            The two values must be integers.

    ????¦É???

    ???????????????§Ö????????????????? ???????? ?????DocStrings?????????????????????????????????????????

    ????????????????????????????????????????§Õ????????????¦Â???????????§µ???????§á??????????????? ?????? ????????????????????????????????????

    ????????__doc__????????????????printMax???????????????????????????????????????Python?? ???????? ???????????????????????????????????????????????????????

    ??????????Python????¨´?help()????????????????DocStings???????????????????????????__doc__??????????????????????????????????????????????????????????§Ñ???help(printMax)???????q???help??

    ??????????????????????????????????????????????? ?????? ???????§Õ???¦Ê??????????§Õ???????????????Python???§Ñœ…????pydoc??????help()????????DocStrings??


    ???? ????? ????
    return??? ??? ????
    ?????
    @ssv 97av