티스토리 뷰
리눅스의 man명령어와 비슷함
함수에 대한 도움말을 볼수 있음
>>> 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.
__doc__ help정보가 저장되는 속성,
사용자가 직접 만드는 함수도 __doc__속성을 이용하여 설명을 적을수 있음
-. __doc__를 이용한 설명넣기
>>> def sum1(x,y):
return x + y
>>> sum1.__doc__ = """
return to the sum of a , b
sum1 = x + y
"""
>>> help(sum1)
Help on function sum1 in module __main__:
sum1(x, y)
return to the sum of a , b
sum1 = x + y
>>> sum1(2,3)
5
-. 함수 지정시 내부에 “””(쌍따옴표3개)를 이용하여 설명넣기
>>> def sum1(x,y):
"""
return to the sum of a , b
sum1 = x + y
"""
return x + y
>>> help(sum1)
Help on function sum1 in module __main__:
sum1(x, y)
return to the sum of a , b
sum1 = x + y
>>> sum1(2,3)
5
'Python' 카테고리의 다른 글
Python, if문 (0) | 2016.04.21 |
---|---|
Python, 이터레이터(Iterator) & 제네레이터(Generator) (0) | 2016.04.21 |
Python, Pass (0) | 2016.04.21 |
Python, 재귀적 함수 호출 (0) | 2016.04.21 |
Python, 함수 lambda (0) | 2016.04.21 |
- Total
- Today
- Yesterday
- 파이썬
- vba
- Private
- indicatoron
- 상수
- Java
- FetchType
- activeforeground
- Composite Key
- Module
- checkbutton
- 폼
- Python
- borderwidth
- highlightbackground
- fetch join
- apache
- highlightthickness
- onetomany
- tkinter command & bind [명령어묶기와 사건묶기] Python
- JPA
- 리눅스
- disabledforeground
- tkinter
- Excel
- activebackground
- Linux
- IdClass
- ManyToOne
- command
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |