Categories
Uncategorised

List of dicts to table with PrettyTable

Given:

summaryList = [{"Event Name": "Pod_Service_MTTR_Notify", "Count": 1}, {"Event Name": "Pod_Service_No_2_alert", "Count": 20}]
if summaryList:
    summaryTable = PrettyTable(summaryList[0])
    for i in summaryList:
        summaryTable.add_row(i.values())

Leave a Reply

Your email address will not be published. Required fields are marked *