I have this bit of code that I need printed out in this exact order (Visitor Team, Visitor Rating, Home Team, Home Rating, Expected Winner, Margin) when I run it through tabulate.
final_dict = {'Visitor Team': visitor_team, 'Visitor Rating': visitor_rating, 'Home Team': home_team,
'Home Rating': home_rating, 'Expected Winner': expected_winner, 'Margin': expected_winner_diff}
print(tabulate(final_dict, headers="keys", floatfmt=".2f", tablefmt="fancy_grid"))
I've been learning and using Python 3.6 and, unbeknownst to me, dicts in 3.6 are ordered now so this actually prints out as I intended it to. It was just dumb luck I guess that Python 3.6 gave me exactly what I needed!
But I went to install Python 3.5 on another computer and this doesn't print out like I want. I've been reading about ordereddicts but I'm not sure how exactly to use it. Do I need to declare final_dict as empty first and then iterate into it the key order I need?