I read the section about .format() function in the Python3.3 documentation and did some online research, but unfortunately I only find examples and explanations for "single" options.
Here is an example:
>>> print("this is a {:>30} test ".format(2.345345345345))
this is a 2.345345345345 test
>>> print("this is a {:.2f} test ".format(2.345345345345))
this is a 2.35 test
But how would I do both at once? I already tried various variation, but unfortunately without success. Anyone knows the correct syntax?
Try
print("this is a {:>30.2f} test ".format(2.345345345345))
When in doubt, try the obvious solutions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With