how to print in columns python code example
Example 1: python text fromatting rows
table_data = [
['a', 'b', 'c'],
['aaaaaaaaaa', 'b', 'c'],
['a', 'bbbbbbbbbb', 'c']
]
for row in table_data:
print("{: >20} {: >20} {: >20}".format(*row))
Example 2: print columns pandas
df = pd.DataFrame(exam_data , index=labels)
# print the columns labeled "name" and "score"
print(df[['name', 'score']])