Python spacing and aligning strings

后端 未结 6 1315
失恋的感觉
失恋的感觉 2020-12-04 08:42

I am trying to add spacing to align text in between two strings vars without using \" \" to do so

Trying to get the text to look like this, with the second co

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 09:25

    You should be able to use the format method:

    "Location: {0:20} Revision {1}".format(Location,Revision)
    

    You will have to figure out the of the format length for each line depending on the length of the label. The User line will need a wider format width than the Location or District lines.

提交回复
热议问题