내장 함수는 모두 help를 통해 사용법을 알 수 있음
>>> help(print)
Help on built-in function print in module builtins:
print(...)
print(value, ..., sep=' ', end='\n', file=sys.stdout)
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.
직접 만든 함수에도 help를 사용 가능함
>>> 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 parameter a, b"
>>> help(plus)
Help on function plus in module __main__:
plus(a, b)
return the sum of parameter a, b