print 함수
📌 print 함수
: 출력할 때 사용되는 함수.
print("hello world") # hello world
print(1234567890) # 1234567890
📌 옵션
아래는 print() 함수에 대한 설명으로, 필요에 따라 옵션을 바꿔 사용할 수 있음.
sep : 문자열과 문자열 사이의 공간.
end : 문자열 끝.
(function)
print(*values: object, sep: str | None = ..., end: str | None = ..., file: SupportsWrite[str] | None = ..., flush: Literal[False] = ...) -> None
print(*values: object, sep: str | None = ..., end: str | None = ..., file: _SupportsWriteAndFlush[str] | None = ..., flush: bool) -> None
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.
print("hello world")
print("hello", "world", sep="~~")
print("hello world", end="\t")
print("hello", "world", sep="~~", end="!!!")
# hello world
# hello~~world
# hello world hello~~world!!!
'Python > Python' 카테고리의 다른 글
[Python] 변수 (0) | 2022.09.06 |
---|---|
[Python] 주석 (0) | 2022.09.06 |
[Python] Python 자료형 (0) | 2022.09.06 |
[Python] 알고 있으면 편한 단축키 (0) | 2022.09.06 |
[Python] Visual Studio Code 추가 설정 (0) | 2022.09.05 |
댓글