print(*objects, sep = ' ', end = '\n', file = sys.stdout, flush = False)
The print function prints the first argument, objects, in the file channel, using sep as a separator and followed by end. The arguments sep, end, file, and flush, if specified, must be given as keyword arguments.
All arguments that are not specified with a keyword are converted to text strings. Both sep and end must be text strings, although they can also be None, which will mean that the default values are considered.
If no object to print is specified, the function simply prints end.
Whether or not the output is buffered is determined by the file channel, but if the flush argument takes the value True, the buffer is forced to be flushed.
- objects: objects to print.
- sep: (optional) separator to use between objects. The default is a blank space.
- end: (optional) text string to print at the end. The default is a newline.
- file: (optional) channel to use for printing.
- flush: (optional) boolean that determines whether to force buffer flush.
The function can print one or more objects simultaneously:
x, y = 1, 2
print(x, y)
In this example the objects are separated by a dash:
x, y = 1, 2
print(x, y, sep = "-")
Here we use a newline character as a separator:
x, y = 1, 2
print(x, y, sep = "\n")
In this example we print the objects with a custom print completion text string:
x, y = 1, 2
print(x, y, end = "*")
Finally, we print the objects by customizing the text string to use between them and forcing the buffer to be emptied:
x, y = 1, 2
print(x, y, sep = "*", flush = True)