Answers for "python string format table"

0

print a formatted table using python

d = [ ["Mark", 12, 95],
     ["Jay", 11, 88],
     ["Jack", 14, 90]]
     
print ("{:<8} {:<15} {:<10}".format('Name','Age','Percent'))

for v in d:
    name, age, perc = v
    print ("{:<8} {:<15} {:<10}".format( name, age, perc))
Posted by: Guest on June-24-2021
0

print a formatted table using python

import pandas as pd

d = [ ["Mark", 12, 95],
     ["Jay", 11, 88],
     ["Jack", 14, 90]]

df = pd.DataFrame(d, columns = ['Name','Age','Percent'])
print(df)
Posted by: Guest on June-24-2021
1

print python format

print('{} {}'.format(1, 2))
Posted by: Guest on May-04-2020

Python Answers by Framework

Browse Popular Code Answers by Language