1) My goal is to create a sequence that is a list that contains ordered dictionaries. The only problem for me will be described below.
OrderedDict()
doesn't show up. However, I do not mind if it shows up in return values. Like you know how when you print a list it doesn't show up as list(index0, index1, ... etc)
but instead it shows up as [index0, index1, ... etc]
. That is what I mean. Inside the point, it would look like thispoint = {'height': 1, 'weight': 3, 'age': 5, etc}
<- It could be brackets or braces or parentheses. Just some type of "end mark", but I preferably would like it to be in {} and having key value pairs indicated by key: value and have them separated by commas.
what_i_am_looking_for = [point0, point1, point2, point3, ... etc]
In Python 3.6, the ordinary dict
implementation was re-written and maintains key insertion order like OrderedDict
, but was considered an implementation detail. Python 3.7 made this feature an official part of the language spec, so if you use Python 3.6+ just use dict
instead of OrderedDict
if you don't care about backward-compatibility with Python 3.5 or earlier.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.