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.

Similar Reads

Logging in Python

Logging in Python is a technique to display useful messages and warnings to users. The logging module provides a flexible way to log different messages in various output destinations such as on the console, in files, and on networks. Logging is a best practice for production code. The logging module provides features such as log levels and filtering....

Print in Python

...

Difference between Logging and Print in Python

...