반응형
/******************************************************************************************************
-- Title : [PY3.3] pass구문 및 help 함수와 __doc__속성
-- Reference : 빠르게 활용하는 파이썬3 프로그래밍
-- Key word : 파이썬 python pass help doc
******************************************************************************************************/

#-- 아무것도 안하고 그냥 지나감(pass)
>>> while true:
           pass
>>>
>>> def sample():
            pass
>>> sample()

#-- 함수의 설명 보기(help)
>>> help(print)
Help on built-in function print in module builtins:
print(...)
    print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
   
    Prints the values to a stream, or to sys.stdout by default.
    Optional keyword arguments:
    file:  a file-like object (stream); defaults to the current sys.stdout.
    sep:   string inserted between values, default a space.
    end:   string appended after the last value, default a newline.
    flush: whether to forcibly flush the stream.
>>> def plus(a,b):
            return a+b
>>> help(plus)
Help on function plus in module __main__:
plus(a, b)

#-- 더 자세한 설명 추가(__doc__)
>>> plus.__doc__ = "return the sum of kkkkkkkk"
>>> help(plus)
Help on function plus in module __main__:
plus(a, b)
    return the sum of kkkkkkkk

 
반응형

+ Recent posts