I have a list formatted like the following:
list_of_DVDsuppliers=[["a","m",15],["w","p",34]]
I'd like to print out the contents of this list as a table with some headers. Here's what I've tried so far:
def dvdprintsoftlist():
print(list_of_DVDsoftwears)
''' printing the available DVDstocks,supplier's details '''
print("This is your current list of stock")
print("Supplier Name Softwear Name Amount")
print("----------------------------------------------------------------")
for (index,[name,softname,amount]) in enumerate (list_of_DVDsuppliers):
print(name + " " +softname + " " +str(amount) + " ")
print("----------------------------------------------------------------")
print("")
The problem is that this code doesn't align the table columns properly. How can I make sure all the entries are aligned with each other?
I'd also like to export my data in CSV format so that other programs can read it, but that's a separate question.