Aligning with string formatting
问题 I wish to achieve this sort of output with string formatting: GBP......0.8639......0.8399 I have tried using the following code (i stands for currency and e[0] and e[1] are buy and sell values): "{i:.<10}{e[0]:.^6}{e[1]:.>6}".format(i=i, e=e) but the above code does not align the second number to the right, but it just adds it behind the first number, like this: GBP.......0.86390.8399 How can I correct this? 回答1: As a generalized solution: Use this format string if you want the right column,