This print()
function returns a printed representation of the objects.
print(*objects, sep=’ ‘, end=’n’, file=sys.stdout)
Here,
Note: All non-keyword arguments are converted to strings like str()
does and written to the stream, separated by sep and followed by end. Both sep and end must be strings; they can also be None, which means to use the default values. If no objects are given, print()
will just write end.
This function is not normally available as a built-in since the name print is recognized as the print statement. To disable the statement and use the print()
function, use this future statement at the top of your module:
>>> from __future__ import print_function
>>> from __future__ import print_function
>>> print('a', 'b')
a b
>>> print(1, 2, 3, sep='|')
1|2|3
>>> print('cloudyfox technology', end='|')
cloudyfox technology|
>>> print('cloudyfox', file=open(r'/home/sagar/text.txt', "w"))
>>> open(r'/home/sagar/text.txt', "r").read()
'cloudyfox\\n'