print() function in Python converts the given object(s) to a string first before printing it (them) to the screen.
The syntax of
print() function is:
print(Object(s), sep=‘ ‘, end=‘\n’, file=sys.stdout, flush=False)
Object(s) - Object(s) to be printed on the screen.
sep - object(s) are printed separately with the separator in between, and the default value is ‘ ’. (optional)
end - end is printed at last, and the default value is ‘/n’.(optional)
file - Object with a write(string) function, and the default value is
flush - If True, the stream is flushed otherwise buffered and the default value is False. (optional)
print()function in Python returns
print("Educative", "provides interactive courses.")
print("Educative", "Provides interective courses.", sep=": ")
print("Educative", end=' !!')
# Creating output file with open('output/output.txt', 'w') as f: print('Educative', file=f) # Printing Educative in output.txt file
View all Courses