FreeKB - Printing text to the console in Python (print)
Printing text to the console in Python (print)

Home > Search


The print command can be used to print text to the console in Python. In this example, the text Hello World is printed to the console.

print("Hello World")

 

Or, if the variable foo contains a value of bar, this will print bar to the console.

print(foo)

 

To print both text and a variable, use the + character.

print("Hello World " + foo)

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments