Q:

pretty table module in python

from prettytable import PrettyTable
PTables = PrettyTable()

PTables = PrettyTable()
    PTables.field_names = ["Selection No.", "Weapon Name", "Damage"]
    PTables.add_row(["0", "Fist", "1 dp"])
    PTables.add_row(["1", "Knuckle Busters", "2.5 dp"])
    PTables.add_row(["2", "Cheap Knife", "5 dp"])
    PTables.add_row(["3", "Wooden Baton", "6 dp"])
    print(PTables)
3
pip install -U prettytable
1
from prettytable import PrettyTable 
  
columns = ["Student Name", "Class", "Section", "Percentage"] 
  
myTable = PrettyTable() 
  
# Add Columns 
myTable.add_column(columns[0], ["Leanord", "Penny", "Howard", 
                       "Bernadette", "Sheldon", "Raj", "Amy"]) 
myTable.add_column(columns[1], ["X", "X", "X", "X", "X", "X", "X"]) 
myTable.add_column(columns[2], ["B", "C", "A", "D", "A", "B", "B"]) 
myTable.add_column(columns[3], ["91.2 %", "63.5 %", "90.23 %", "92.7 %",  
                                          "98.2 %", "88.1 %", "95.0 %"]) 
  
print(myTable)
0

New to Communities?

Join the community