On this page
Prev: pow | Up: __builtins__ | Next: property
Rel: breakpoint, compile, eval, exec, globals
Ref: docs.python.org — print
Tags: #public #python3 #builtins
Import & Availability
# Built-in (available globally without import)
from builtins import print
Overview & Signature
print(*args, sep=' ', end='\n', file=None, flush=False)
Prints the values to a stream, or to sys.stdout by default.
Usage
import io
buf = io.StringIO()
print("a", "b", "c", sep="-", end="!", file=buf)
assert buf.getvalue() == "a-b-c!"
Gotchas
- Pass
flush=Truefor progress lines or container logs where stdout is block-buffered. - Use
logginginstead ofprint()in libraries and production services.
REPL Inspect
help(print)
Linked from
Related notes
- tuts/python3/__builtins__/__builtins__ Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/pow Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/property Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__ links to this page; shared tags: #builtins
- tuts/python3/__builtins__/breakpoint Linked here; shared tags: #builtins
- tuts/python3/__builtins__/compile Linked here; shared tags: #builtins
- tuts/python3/__builtins__/eval Linked here; shared tags: #builtins
- tuts/python3/__builtins__/exec Linked here; shared tags: #builtins
- tuts/python3/__builtins__/globals Linked here; shared tags: #builtins
- tuts/python3/tutorials/core_fundamentals/syntax_and_variables links to this page