๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_func_print.asp
Python print() Function
Python Examples Python Compiler ... Plan Python Interview Q&A Python Training ... The print() function prints the specified message to the screen, or other standard output device....
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ print-function
Explore Python's print() function, master output customization
Master Python from basics to advanced topics, including data structures, functions, classes, and error handling ... Start your coding journey with Python. Learn basics, data types, control flow, and more ... # 1. Print a simple text string print("Hello, World!") # Outputs: Hello, World! # 2. ...
๐ŸŒ
Real Python
realpython.com โ€บ python-print
Your Guide to the Python print() Function โ€“ Real Python
July 3, 2026 - Imagine youโ€™re writing a countdown timer, which should append the remaining time to the same line every second: ... import time num_seconds = 3 for countdown in reversed(range(num_seconds + 1)): if countdown > 0: print(countdown, end="...") time.s...
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ tutorial โ€บ inputoutput.html
7. Input and output โ€” Python 3.15.0 documentation
Given format % values (where format ... is commonly known as string interpolation. For example: >>> import math >>> print('The value of pi is approximately %5.3f.'...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python-output-using-print-function
Python - Print Output using print() function - GeeksforGeeks
"": An empty quote ("") is used to print an empty line. This code uses \n to print the data to the new line. ... GeeksforGeeks is best for DSA Content. In this example, we are concatenating strings inside print() function.
Published: April 2, 2025
๐ŸŒ
Stanford CS
cs.stanford.edu โ€บ people โ€บ nick โ€บ py โ€บ python-print.html
print() and Standard Out
The Python print() function takes in any number of parameters, and prints them out on one line of text. The items are each converted to text form, separated by spaces, and there is a single '\n' at the end (the "newline" char). When called with zero parameters, print() just prints the '\n' ...
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ whatsnew โ€บ 3.0.html
Whatโ€™s New In Python 3.0
The print() function doesnโ€™t support the โ€œsoftspaceโ€ feature of the old print statement. For example, in Python 2.x, print "A\n", "B" would write "A\nB\n"; but in Python 3.0, print("A\n", "B") writes "A\n B\n".
๐ŸŒ
Guru99
guru99.com โ€บ home โ€บ python โ€บ python print() statement: how to print with examples
Python Print() Statement: How to Print with Examples
July 10, 2026 - This is available only in Python 3+. ... Welcome to Guru99! ... In Python 2, print was a statement written as print โ€œtextโ€. In Python 3, print is a function called as print(โ€œtextโ€) with parentheses.
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ python-print-function
Python Print() Function: How to use Print Statement with Examples | DataCamp
February 28, 2020 - To understand this, let's take an example by defining a list of integers and pass it to the print function. You would expect it to print the list of integers. int_list = [1,2,3,4,5,6] print(int_list) [1, 2, 3, 4, 5, 6] end: It is a string appended after the last value, defaults to a newline.
Find elsewhere
Top answer
1 of 5
21

No, you cannot. The print statement is gone in Python 3; the compiler doesn't support it anymore.

You can make print() work like a function in Python 2; put this at the top of every module that uses print:

from __future__ import print_function

This will remove support for the print statement in Python 2 just like it is gone in Python 3, and you can use the print() function that ships with Python 2.

six can only help bridge code written with both Python 2 and 3 in mind; that includes replacing print statements with print() functions first.

You probably want to read the Porting Python 2 Code to Python 3 howto; it'll tell you about more such from __future__ imports as well, as well as introduce tools such as Modernize and Futurize that can help automate fixing Python 2 code to work on both Python 2 and 3.

2 of 5
10

You can use the tool 2to3 is an Automated Python 2 to 3 code translation, as @Martijn Pietersโ™ฆ told :), you can get over a ride throw the old python and making the changes work into python 3, I make a simple example like this:

I created this file, python2.py:

#!python3

print 5

when I run it with python it obviously shows:

line 3
    print 5          ^
SyntaxError: Missing parentheses in call to 'print'

so, you can transform it via terminal like this:

This is the important comand

$ 2to3 -w home/path_to_file/python2.py

-w parameter will write the file, if you want only see the future changes without apply them, just run it without -w. after run it it will show something like

root: Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
RefactoringTool: Refactored Desktop/stackoverflow/goto.py
--- Desktop/stackoverflow/goto.py   (original)
+++ Desktop/stackoverflow/goto.py   (refactored)
@@ -1,3 +1,3 @@
 #!python3

-print 5
+print(5)
RefactoringTool: Files that were modified:

And the file will look like:

#!python3

print(5)
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ built-in โ€บ print
Python print()
print("Python is fun.") a = 5 # Two objects are passed ... Python is fun. a = 5 a = 5 = b ยท In the above program, only the objects parameter is passed to print() function (in all three print statements).
๐ŸŒ
Software Testing Help
softwaretestinghelp.com โ€บ home โ€บ python โ€บ complete guide to python print() function with examples
Complete Guide To Python print() Function With Examples
April 1, 2025 - In Python3 โ€œ print โ€ became a function and it needs parentheses. ... The output will be โ€œ 4 6 โ€ and โ€œ print 2, 3 โ€ will drop a syntax error as it is a function and needs the parentheses.
๐ŸŒ
w3resource
w3resource.com โ€บ python โ€บ python-print-statement.php
Python print() function
For proper alignment, a space can be left blank in the field width so that when a negative number is used, proper alignment is maintained. print("% 9f" % 5.1234567890) print("% 9f" % -5.1234567890)
๐ŸŒ
CodeHS
codehs.com โ€บ documentation โ€บ new โ€บ python3 โ€บ print
Documentation - Python 3 | CodeHS
If no conditions are true, the commands inside the else block will be performed. if condition_1: print("This executes if condition_1 evaluates to True") elif condition_2: print("This executes if condition_2 evaluates to True") else: print("This executes if no prior conditions evaluate to True") # Example: # This program will print that the color is secondary color == "purple" if color == "red" or color == "blue" or color == "yellow": print("Primary color.") elif color == "green" or color == "orange" or color == "purple": print("Secondary color.") else: print("Not a primary or secondary color.")
๐ŸŒ
Pi My Life Up
pimylifeup.com โ€บ home โ€บ how to use the print() function in python
How to Use the print() Function in Python - Pi My Life Up
June 20, 2022 - In this tutorial, we will touch on the syntax of the function and several examples of how you can use it in your Python script. The print function will print a message to the terminal or selected output file. The message can be an object, string, or combination of different datatypes. Whatever you specify, the print function will convert them to a string before being outputted to the terminal or file. In Python 3, the print statement was replaced by the print function.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
How to Use print() in Python | note.nkmk.me
May 10, 2023 - Unless you're familiar with the C-style printf, which uses conversion specifiers like %d, %f.2, and %s, it's recommended to use the format() method or f-strings, as mentioned in the official documentation. Note that f-strings were added in Python 3.6 and are not available in earlier versions.
๐ŸŒ
Snarky
snarky.ca โ€บ why-print-became-a-function-in-python-3
Why `print` became a function in Python 3
August 20, 2018 - For users, making print a function lets you use print as an expression, unlike the print statement which can only be used as a statement. As an example, let's say you wanted to print an ellipsis after every line to indicate that more ...