3 ms·
It has optional arguments which make certain things a lot easier and make it much more consistent with the rest of the language. sep is the separator between a
by samdk 16y ago
It has optional arguments which make certain things a lot easier and make it much more consistent with the rest of the language.
sep is the separator between arguments, so you can do something like:
>> print('a','b','c',sep='')
abc
end is the value at the end of the line (useful, for example, if you want to print without a newline at the end).
file lets you specify a file to print to, so for example you can do file=sys.stderr to print to stderr instead of stdout.
- gometro33 16y agoBeing part of __future__, is print() slated for release in 2.7 or is it strictly a 3.x feature?
- algorias 16y agoAll that is just syntactic sugar. print "comma prevents a newline from being printed", print >> sys.stderr, "Any file object can be used" The change to a function is purely for consistency, not functionality.