How to print spaces in Python?


In C++, \n is used, but what do I use in Python?

I don't want to have to use: print (" "). This doesn't seem very elegant.

Any help will be greatly appreciated!

This question is tagged with python

~ Asked on 2012-09-16 21:02:11

The Best Answer is


Here's a short answer

x=' ';

This will print one white space


This will print 10 white spaces


Print 10 whites spaces between Hello & World


~ Answered on 2015-10-29 21:25:34


If you need to separate certain elements with spaces you could do something like

print "hello", "there"

Notice the comma between "hello" and "there".

If you want to print a new line (i.e. \n) you could just use print without any arguments.

~ Answered on 2012-09-16 21:04:58

Most Viewed Questions: