Python print or display output

Print functionality is used to show text, variables or other objects value on output. Output could be a console or some sort of view. In this tutorial section, you will learn about how to work with print functionality.


Objectives

  • Python print basic

  • Python print function details


Python print basic

Print a message onto the console by blow function.

print("This is Bismillah Program")

Output

This is Bismillah Program

Process finished with exit code 0


Python print function details

Advance print() Syntax

print(args, separator, end, file, flush)

Parameter Details

Name Description

args

Any object, and as many as you like. Will be converted to string before printed

separator

Optional. Specify how to separate the objects, if there is more than one. Default is ' '

end

Optional. Specify what to print at the end. Default is '\n' (new line)

file

Optional. An object with a write method. Default is sys.stdout

flush

Optional. A Boolean, specifying if the output is flushed (True) or buffered (False). Default is False


Python print multiple item

Code

print("My name is", "Touhid")

Output

My name is Touhid

Process finished with exit code 0


Python print tuple

Code

laptop = ("apple", "hp", "dell")
print(laptop)

Output

('apple', 'hp', 'dell')

Process finished with exit code 0


Python print using custom seperator

Code

print("My name is", "Touhid", sep=" >> ")

Output

My name is >> Touhid

Process finished with exit code 0


Python print custom end

Code

print("Python Beginner course", end=" <end> ")
print("Now I am a Programmer")

Output

Python Beginner course <end> Now I am a Programmer

Process finished with exit code 0


Python show output using print functionality video tutorial