擅长:python、mysql、java
<pre><code>header = ['Name', 'Count', 'Correct', 'Incorrect', 'Accuracy', 'Total']
my_list = [
['Abena', '3', '3', '0', '100', '45'],
['Malcolm', '1', '1', '0', '100', '1'],
['Jane', '1', '1', '0', '100', '20'],
['Andy', '1', '0', '1', '0', '20'],
['Sandip', '0', '0', '0', '0', '0'],
['Liz', '1', '1', '0', '100', '10']
]
print("{: >10} {: >10} {: >10} {: >10} {: >10} {: >10}".format(*header))
for row in my_list:
print("{: >10} {: >10} {: >10} {: >10} {: >10} {: >10}".format(*row))
</code></pre>
<p>输出为:</p>
<pre><code> Name Count Correct Incorrect Accuracy Total
Abena 3 3 0 100 45
Malcolm 1 1 0 100 1
Jane 1 1 0 100 20
Andy 1 0 1 0 20
Sandip 0 0 0 0 0
Liz 1 1 0 100 10
</code></pre>
<p>您可以根据需要编辑列长度。这里使用10。你知道吗</p>