Printing Lists as Tabular Data

后端 未结 14 2398
小蘑菇
小蘑菇 2020-11-21 06:38

I am quite new to Python and I am now struggling with formatting my data nicely for printed output.

I have one list that is used for two headings, and a matrix that

14条回答
  •  半阙折子戏
    2020-11-21 07:03

    I would try to loop through the list and use a CSV formatter to represent the data you want.

    You can specify tabs, commas, or any other char as the delimiter.

    Otherwise, just loop through the list and print "\t" after each element

    http://docs.python.org/library/csv.html

提交回复
热议问题