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)
Here is what the above code is Doing:
1. We’re creating a new PrettyTable object called PTables.
2. We’re setting the field names for the table.
3. We’re adding rows to the table.
4. We’re printing the table.