In this article, we will learn about how to print space or multiple spaces in the Python programming language. Spacing in Python language is quite simple than other programming language. In C languages, to print 10 spaces a loop is used while in python no loop is used to print number of spaces.
Following are the example of the print spaces:
Example 1: A simple way to print spaces
Python3
# Python program to print spaces # No spacesprint("GeeksForGeeks") # To print the blank linesprint(' ') # Also print the blanksprint(" ") # To print the spaces in sentenceprint("Geeks For Geeks") |
Output:
GeeksForGeeks Geeks For Geeks
Example 2: Printing spaces between two values while printing in a single print statement.
Python3
# Python program to print spacesx = 1y = 2 # use of "," symbolprint("x:",x)print("y:",y)print(x,"+",y,"=",x+y) |
Output:
x: 1 y: 2 1 + 2 = 3
Example 3: Print multiple spaces between two values.
Python3
# Python program to print spaces # To print the single spaces in sentenceprint("Geeks"+" "+"For"+" "+"Geeks")print("Geeks","For","Geeks") # to print spaces by given timesprint("Geeks"+" "*3+"For"+" "*3+"Geeks")print("Geeks"+" "*5+"For"+" "*10+"Geeks") |
Output:
Geeks For Geeks Geeks For Geeks Geeks For Geeks Geeks For Geeks

… [Trackback]
[…] Read More Info here to that Topic: geeksforgeeks.org/how-to-print-spaces-in-python3/ […]
… [Trackback]
[…] Find More on to that Topic: geeksforgeeks.org/how-to-print-spaces-in-python3/ […]
… [Trackback]
[…] Read More Info here on that Topic: geeksforgeeks.org/how-to-print-spaces-in-python3/ […]