I have a dict with n parameters:
print(table)
{
"Parameters":{
"erVersion":"1.0",
"A":"a",
"rVersion":"1.0",
"B":"b",
"C":"c",
"Ur":"legislator",
"RecordSize":"13",
"classification":"json",
"compressionType":"none"
}
}
I wanted to place the parameters A, B and C to the top of parameters. I tried doing this with the following code:
table['Parameters'].move_to_end("C", last=False)
table['Parameters'].move_to_end("B", last=False)
table['Parameters'].move_to_end("A", last=False)
This however doesn't work as of Python 3.5+ (refference:https://stackoverflow.com/a/16664932/7615751)
Is there an alternative to this with newer versions of Python? If a different approach is better I'd also appreciate the suggestion to use it.
I don't want to solve this by defining a fixed parameter order because I have a lot of tables like this with a different number of parameters (they always have the A, B, C parameter though).