`tabulate` order columns by keys

Viewed 5845

I want to print my list output in a different column order. I use tabulate but could use other tools. The strings have different length and part of the problem is to "automatically" define the column length, which tabulate does really well!

Code:

parameter_list = []
parameter_list.append({
    'A': "Hello",
    'B': "You",
    'C': False
})
parameter_list.append({
    'A': "Salue",
    'B': "Tu",
    'C': False
})

print tabulate(parameter_list, headers='keys')

Output - IS:

A     B   C
----- --- -----
Hello You False
Salue Tu  False

Output - WANT:

C     A     B
----- ----- ---
False Hello You
False Salue Tu
1 Answers
Related