How to print space in Python
In this article, we will learn how to print space in Python.
Printing spaces results in empty spaces being displayed.
Print a Single Whitespace
We can use print(value)
with value as " "
to print a space on a single line.
>>> print("ab") ab >>> print(" ") >>> print("a") a
Print a multiple whitespaces
We can use print(value)
with value as " "*n
to print n
-many spaces on a single line.
>>> print(" "*5) >>> print(" "*5 + "abc") abc
Subscribe
Login
Please login to comment
0 Discussion