#! python3
print ("Space wanted")
gives: Space wanted
How to print the embedded spaces?
#! python3
print ("Space wanted")
gives: Space wanted
How to print the embedded spaces?
The output console is html/css…
So:
#! python3
print("Spaces              end")
#or
spaces = " " * 20
print("Spaces" + spaces + "end")
#or
print("Spaces" + " " * 20 + "end")
The last is more concise. Or you could add a function.
Or use replace.
y = "Spaces end"
y = y.replace(" ", " ")
print(y)
Thank you!
I now can use:
#! python3
# -*- coding: utf-8 -*-
x = "space 23.45"
y = x.replace(" ", " ")
print (y)
x = "space".ljust(10) + "23.45".rjust(8)
y = x.replace(" ", " ")
print (y)
x = f"{'space': <10}{"23.45": >8}"
y = x.replace(" ", " ")
print (y)
giving:
space 23.45
space 23.45
space 23.45
You may want to look at other html/css depending on how you want to format your output.