How to Print “Pretty” String Output in Python

后端 未结 4 1688
不知归路
不知归路 2020-12-02 13:31

I have a list of dicts with the fields classid, dept, coursenum, area, and title from a sql query. I would like to output the values in a human readable format. I was thinki

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 14:18

    You can simply left justify the string to a certain number of characters if you want to keep it simple:

    print string1.ljust(20) + string2.ljust(20)
    

提交回复
热议问题