To structure my console output, I want to print some information and I would like to start with an underlined headline. But how to do it nicely without creating an extra variable?
Right now I do it like this:
print("{:s}\n{:s}\n".format("This is an underlined headline.", len("This is an underlined headline.") * "-"))
what gives me the desired output:
This is an underlined headline.
-------------------------------
But that code is bad. Is there some better format string to achieve that?
print("{0:s}\n?????\n".format("This is an underlined headline.", "-"))
Thank you :)