Specifying spaces between words


how could I use whitespaces in python that in the could I can specify how mach the space between the words

print "John and (5 spaces) Mark went to (3 spaces) London"

how could I specify 5 spaces as a code without typing it as " "


You could try this:

space = " " print "John and{}Mark went to{}London".format(space*5,space*3)

<a href="https://docs.python.org/2/library/string.html#formatspec" rel="nofollow">Here you can find more information</a>


is there anyway to use for example \s{5} ?

Am I understood corectly:

space = " " print "John and %s Mark went to %s London" % (space*5,space*3)


If you want the numbers of spaces in the template string instead of the arguments to format:

>>> "John and{0:5s}Mark went to{0:3s}London".format("") 'John and Mark went to London'


  • Are this textures?
  • Get max row per group from a related table
  • How to install Valgrind on macOS Mojave(10.14) with Homebrew?
  • Issue with Crashlytics and Answers kit
  • .gitignore not ignoring filenames with spaces in them on `git status`
  • How to change a time zone in a data frame?
  • Get current pthread cpu usage Mac OS X [closed]
  • SQLCipher iOS OpenSSL Build error: line 66: ./config: No such file or directory
  • Vim get length of matched line
  • NSWorkspace runningApplications doesn't return my XPC mach service
  • Error in dev.off() : cannot shut down device 1 (the null device)
  • vim replace a string when a change occurred in another place
  • XPath expression with white space in node for defiant.js
  • Installing MEAN Stack: npm -v module.js: 338 throw err; Error: Cannot find module './cache/cach
  • How to use the File System Events API in Swift?
  • Column Nullability/Optionality: NULL vs NOT NULL
  • What's the benefit of the trailing apostrophe in character literals
  • String encoding problem on PdoStatement->bindParam()?
  • Apple Mach - O Linker Error.No such file or directory Swifty Json
  • How to make a npm command, that executes two commands in the console (one after another)?
  • In VIm, how to remove all lines that are duplicate somewhere?
  • Self join tutorial #10 on sqlzoo
  • IE readonly textarea problem
  • How to retrieve a specific string from a specific list from a file with JSON in Python
  • Updating and removing unique join relationships in CakePHP
  • Haskell: function composition with anonymous/lambda function
  • EF 4.1 DBContext AutoDetectChangesEnabled
  • Creating a Multidimensional, Associative Array in VBScript
  • import scipy.sparse failed
  • Validate jQuery plugin, field not required
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • Python pickle not one-to-one: different pickles give same object
  • Reading a file into a multidimensional array
  • preg_replace Double Spaces to tab (\\t) at the beginning of a line
  • Highlight one bar in a series in highcharts?
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • java string with new operator and a literal