What is ‘print’ in Python?

In 2.7 and down, print is a statement. In python 3, print is a function. To use the print function in Python 2.6 or 2.7, you can do

>>> from __future__ import print_function
>>> print(print)
<built-in function print>

See this section from the Python Language Reference, as well as PEP 3105 for why it changed.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)