
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
What does print() function do in Python?
In Python 3, print() is a built-in function (object) that is used to print the argument we give it to the screen. For example,
>>> print("Hello!") Hello! >>> print(5) 5
Before this, print was a statement. It could be used in the following way:
>>> print "Hello!" Hello! >>> print 5 Hello
It evaluates each expression in turn and writes the resulting object to standard output. If an object is not a string, it is first converted to a string using the standard rules for string conversions. The (resulting or original) string is then written to the screen. You can read more about why the print statement was converted to a function in Python 3 here: https://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function
- Related Articles
- What does "print >>" do in python?
- What does reload() function do in Python?
- What does raw_input() function do in python?
- What does input() function do in python?
- What does open() function do in Python?
- What does close() function do in Python?
- What does os.pipe() function do in Python?
- What does getattr() function do in Python?
- What does hasattr() function do in Python?
- What does setattr() function do in Python?\n\n
- What does delattr() function do in Python?\n\n
- What does the repr() function do in Python Object Oriented Programming?
- What does the str() function do in Python Object Oriented Programming?
- What does the cmp() function do in Python Object Oriented Programming?
- What does the .end() function do in jQuery?

Advertisements