Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python update to beginning of dictionary

#In Python 3.8 ordered dictionaries were added, but they didn't add any functions to deal with this; .update() only adds to the end!
FinishedDict = {Key2 : Value2, Key1 : Value1}
BackDict = {Key3 : Value3}
BackDict.update(FinishedDict)
FinishedDict=BackDict
 
PREVIOUS NEXT
Tagged: #Python #update #beginning #dictionary
ADD COMMENT
Topic
Name
4+7 =