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 sp
Solution 1:
You could try this:
space = " "print"John and{}Mark went to{}London".format(space*5,space*3)
Solution 2:
is there anyway to useforexample \s{5} ?
Am I understood corectly:
space = " "print"John and %s Mark went to %s London" % (space*5,space*3)
Solution 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'
Post a Comment for "Specifying Spaces Between Words"