how to add whitespace in python

Solutions on MaxInterview for how to add whitespace in python by the best coders in the world

showing results for - "how to add whitespace in python"
Riordan
28 Mar 2019
1A simple way would be:
2
3print str(count) + '  ' + str(conv)
4
5If you need more spaces, simply add them to the string:
6
7print str(count) + '    ' + str(conv)
8
9A fancier way, using the new syntax for string formatting:
10
11print '{0}  {1}'.format(count, conv)
12
13Or using the old syntax, limiting the number of decimals to two:
14
15print '%d  %.2f' % (count, conv)