Python: Output using print() Function

This function prints the specified message to the screen, or other standard output device. The message can be a string, or any other object, the object will be converted into a string before written to the screen.

Syntax:

print(object(s), sep=separator, end=end, file=file, flush=flush)

print() Parameters

  • objects - Any Object is converted to string.
  • sep - It specify how to separate the objects, if there is more than one.Default :’ ‘ 
  • end - It specify what to print in last.
  • file - must be an object with write(string) method. If omitted it, sys.stdout will be used which prints objects on the screen.
  • flush - A Boolean, specifying if the output is flushed (True) or buffered (False).

Return Value from print()

It returns output to the screen.

Example:

print("Hello", "how are you?")

Output: Hello how are you?

Tags