在Python中将列表转换为表格

时间:2014-03-26 23:13:27

标签: python list 2d tuples

如何转动students = [("Abe", 200), ("Lindsay", 180), ("Rachel" , 215)]

成:

Abe     200

Lindsay 180

Rachel  215

这应该可以适用于任何大小的列表。

1 个答案:

答案 0 :(得分:2)

students = [("Abe", 200), ("Lindsay", 180), ("Rachel" , 215)]
for student in students:
    print(*student, sep='\t')  # python 3

for student in students:
    print '\t'.join(str(i) for i in student)  # python 2
相关问题