Print in Python
The print statement is a built-in function in Python that prints the specified value or values to the console. It is mainly used for debugging and is not recommended for logging information in production code.
Example:
The print statement will simply print the values to the console.
Python3
name = "Kumar" age = 21 print ( "My name is" , name, "and I'm" , age, "years old." ) |
Output:
My name is Kumar and I'm 21 years old.
Difference between Logging and Print in Python
In Python, print and logging can be used for displaying information, but they serve different purposes. In this article, we will learn what is python logging with some examples and differences between logging and print in Python.