Python Function Reference

print

Print the given values to the console, converting each to a string.

Python 3.13
print(*objects, sep=' ', end='\n', file=None, flush=False)
  • =default value
*objects
The values to print; any number of them, including none.
Any
sep
The string between the values, a space by default.
str | NoneOptional
end
The string at the end of the output, a newline by default.
str | NoneOptional
file
Where to write: the console (sys.stdout) by default, or an open file.
TextIO | NoneOptional
flush
If True, the text is written at once, without buffering.
boolOptional

Return value

Nothing (None); the function only prints text.

Examples

Printing a string

Python 3.13
print("Hello, world!")
Hello, world!

Custom separator between values

Python 3.13
print('2024', '10', '06', sep='-')
2024-10-06

Printing without a newline

Python 3.13
print('Loading', end='...')
print('done')
Loading...done

Details

Calling print() without arguments prints an empty line.

See also

Where to learn