removing keys and values from a nested dictionary - python

I'm relatively new to programming and I'm quite stuck.
I have a dictionary like this below. I want to say like
n = "a"
then I want to remove every variable n from the dictionary.
Then I want to remove every letter a that is in this nested dictionary below. I know how to remove stuff from dictionaries to a tiny extent, but I'm quite confused right now as I don't know how to do it with a nested dictionary. In this case, there's a key and then a value but inside the value is another dictionary with other keys and values. I have implemented for loops etc. to try and do what I want to do but the solution I get isn't what I'm looking for.
Thank you:)
{'b': {'a': 7, 'c': 10, 'd': 15}, 'a': {'b': 7, 'c': 9, 'f': 14}, 'c': {'a': 9, 'b': 10, 'd': 11, 'f': 2}, 'f': {'a': 14, 'c': 2, 'e': 9}, 'd': {'b': 15, 'c': 11, 'e': 6}, 'e': {'d': 6, 'f': 9}}
dic = {'b': {'a': 7, 'c': 10, 'd': 15}, 'a': {'b': 7, 'c': 9, 'f': 14}, 'c': {'a': 9, 'b': 10, 'd': 11, 'f': 2}, 'f': {'a': 14, 'c': 2, 'e': 9}, 'd': {'b': 15, 'c': 11, 'e': 6}, 'e': {'d': 6, 'f': 9}}
This is what I have so far, but it's just removing the first b which is a key, how do i access the b's inside the nested dictionary
n = "b"
del dic[n]
print(dic)
and whenever I do something like :
dic = {'b': {'a': 7, 'c': 10, 'd': 15}, 'a': {'b': 7, 'c': 9, 'f': 14}, 'c': {'a': 9, 'b': 10, 'd': 11, 'f': 2}, 'f': {'a': 14, 'c': 2, 'e': 9}, 'd': {'b': 15, 'c': 11, 'e': 6}, 'e': {'d': 6, 'f': 9}}
and whenever I do something like:
n = "b"
for k in dic.keys():
if k == n:
del dic[k]
it comes up in the terminal that RuntimeError: dictionary changed size during iteration

You could write a recursive function:
def delete_key(k, dic):
if k in dic:
del dic[k]
for val in dic.values():
if isinstance(val, dict):
delete_key(k, val)
return dic
d = {'b': {'a': 7, 'c': 10, 'd': 15}, 'a': {'b': 7, 'c': 9, 'f': 14}, 'c': {'a': 9, 'b': 10, 'd': 11, 'f': 2}, 'f': {'a': 14, 'c': 2, 'e': 9}, 'd': {'b': 15, 'c': 11, 'e': 6}, 'e': {'d': 6, 'f': 9}}
delete_key('b', d)
{'a': {'c': 9, 'f': 14},
'c': {'a': 9, 'd': 11, 'f': 2},
'd': {'c': 11, 'e': 6},
'e': {'d': 6, 'f': 9},
'f': {'a': 14, 'c': 2, 'e': 9}}

Assuming you want to convert the dictionary to a matrix, you can do this as follows:
from sklearn.feature_extraction import DictVectorizer
dictionary = {
'b': {'a': 7, 'c': 10, 'd': 15},
'a': {'b': 7, 'c': 9, 'f': 14},
'c': {'a': 9, 'b': 10, 'd': 11, 'f': 2},
'f': {'a': 14, 'c': 2, 'e': 9},
'd': {'b': 15, 'c': 11, 'e': 6},
'e': {'d': 6, 'f': 9}
}
keys_removed = [dictionary.get(i) for i in dictionary]
dictvectorizer = DictVectorizer(sparse=False)
matrix = dictvectorizer.fit_transform(keys_removed)
This will provide the following output:
[[ 7. 0. 10. 15. 0. 0.]
[ 0. 7. 9. 0. 0. 14.]
[ 9. 10. 0. 11. 0. 2.]
[14. 0. 2. 0. 9. 0.]
[ 0. 15. 11. 0. 6. 0.]
[ 0. 0. 0. 6. 0. 9.]]
With matrix indices corresponding to the inner key values (a to f), which is why the matrix has zeroes where a value does not exist at a specific key.
Alternatively, if you just want to get rid of the main keys, you simply need to use keys_removed = [dictionary.get(i) for i in dictionary] and convert it from a list.
This will give you the following:
[{'a': 7, 'c': 10, 'd': 15}, {'b': 7, 'c': 9, 'f': 14}, {'a': 9, 'b': 10, 'd': 11, 'f': 2}, {'a': 14, 'c': 2, 'e': 9}, {'b': 15, 'c': 11, 'e': 6}, {'d': 6, 'f': 9}]
EDIT
If you want to delete certain keys and their corresponding entries, you could do something like this:
def delete_key(keys: list):
dictionary = {
'b': {'a': 7, 'c': 10, 'd': 15},
'a': {'b': 7, 'c': 9, 'f': 14},
'c': {'a': 9, 'b': 10, 'd': 11, 'f': 2},
'f': {'a': 14, 'c': 2, 'e': 9},
'd': {'b': 15, 'c': 11, 'e': 6},
'e': {'d': 6, 'f': 9}
}
for i in keys:
dictionary.pop(i)
return dictionary
print (delete_key(keys=['a', 'c']))
This takes a list of keys that you want to delete and returns a new dictionary without them. The above case outputs:
{'b': {'a': 7, 'c': 10, 'd': 15}, 'f': {'a': 14, 'c': 2, 'e': 9}, 'd': {'b': 15, 'c': 11, 'e': 6}, 'e': {'d': 6, 'f': 9}}

According to your recent clarifications, this should work:
def delete_key(outer_keys: list, inner_keys: list):
dictionary = {
'b': {'a': 7, 'c': 10, 'd': 15},
'a': {'b': 7, 'c': 9, 'f': 14},
'c': {'a': 9, 'b': 10, 'd': 11, 'f': 2},
'f': {'a': 14, 'c': 2, 'e': 9},
'd': {'b': 15, 'c': 11, 'e': 6},
'e': {'d': 6, 'f': 9}
}
for i in outer_keys:
dictionary.pop(i)
for i in dictionary:
for j in inner_keys:
if j in dictionary[i]:
dictionary[i].pop(j)
return dictionary
print (delete_key(outer_keys=[], inner_keys=['a']))
The function works as follows:
It allows you to specify which keys (and corresponding entries) you want removed. You simply list which in either outer_keys or inner_keys, the latter being the deepest keys in the nested dictionary.
These have to be defined as a list of the key names and can be empty if you want to only remove the keys from the inner or outer.
The above example will output the following:
{'b': {'c': 10, 'd': 15}, 'a': {'b': 7, 'c': 9, 'f': 14}, 'c': {'b': 10, 'd': 11, 'f': 2}, 'f': {'c': 2, 'e': 9}, 'd': {'b': 15, 'c': 11, 'e': 6}, 'e': {'d': 6, 'f': 9}}
You will notice that all of the inner 'a' keys have been removed. The operation can be done using fewer loops, but this should illustrate the process well enough.

Related

Python recursive generator breaks when using list() and append() keywords

I have only recently learned about coroutines using generators and tried to implement the concept in the following recursive function:
def _recursive_nWay_generator(input: list, output={}):
'''
Helper function; used to generate parameter-value pairs
to submit to the model for the simulation.
Parameters
----------
input : list of tuple
every tuple of the list must be of the form:
``('name_of_parameter', iterable_of_values)``
output : list, optional
parameter used for recursion; allows for list building
across subgenerators
Returns
-------
Generator :
Specifications used for simulation setup of the form:
``{'par1': val1, ...}``
'''
# exit condition
if len(input) == 0:
yield output
# recursive loop
else:
curr = input[0]
par_name = curr[0]
for par_value in curr[1]:
output[par_name] = par_value
# coroutines for the win!
yield from _recursive_nWay_generator(input[1:], output=output)
Function somewhat works as intended:
testlist = [('a', (1, 2, 3)), ('b', (4, 5, 6)), ('c', (7, 8))]
for a in _recursive_nWay_generator(testlist):
print(a)
Output:
{'a': 1, 'b': 4, 'c': 7}
{'a': 1, 'b': 4, 'c': 8}
{'a': 1, 'b': 5, 'c': 7}
{'a': 1, 'b': 5, 'c': 8}
{'a': 1, 'b': 6, 'c': 7}
{'a': 1, 'b': 6, 'c': 8}
{'a': 2, 'b': 4, 'c': 7}
{'a': 2, 'b': 4, 'c': 8}
{'a': 2, 'b': 5, 'c': 7}
{'a': 2, 'b': 5, 'c': 8}
{'a': 2, 'b': 6, 'c': 7}
{'a': 2, 'b': 6, 'c': 8}
{'a': 3, 'b': 4, 'c': 7}
{'a': 3, 'b': 4, 'c': 8}
{'a': 3, 'b': 5, 'c': 7}
{'a': 3, 'b': 5, 'c': 8}
{'a': 3, 'b': 6, 'c': 7}
{'a': 3, 'b': 6, 'c': 8}
However, it breaks when I try to append to an existing list or construct a new one:
gen = _recursive_nWay_generator(testlist)
print(list(gen))
Output:
[{'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}, {'a': 3, 'b': 6, 'c': 8}]
This question was attempting to do something close to what I have, but I'm not seeing answers that could help.
I am honestly clueless as to how to solve this, the online searches I tried gave nothing no matter how I phrase the question. If this was answered before I'll be happy to just follow the link.
The problem with your code is reusing the same mutable output dict during the iteration and recursive calls. That is, you yield output and then later on you modify it with output[par_name] = par_value but it's the same dict in each case - so you're modifying the instance which was already returned! If you append each result into a list and then print them all at the end, you'll see that they're identical - it's the same result yielded each time.
The simplest way to "fix" your existing code is to yield copies, i.e. change the line:
yield output
into this:
yield dict(output.items())
However, this algorithm is not great, and I recommend you look for something better. Using recursion is poor choice here. I'll offer you a simple/direct way to generate the sequence more efficiently:
import itertools as it
testlist = [('a', (1, 2, 3)), ('b', (4, 5, 6)), ('c', (7, 8))]
keys, vals = zip(*testlist)
for p in it.product(*vals):
print(dict(zip(keys, p)))

Merging two or more dictionaries when they have the same key value pairs [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I am trying to merge two or more dictionaries in a list to combine them using same set of key value pairs. If the specified key value pairs exists, then merge the other keys for those dictionaries gets added under 'other_cols'. Below is what my input looks like and what I am expecting as an output.
input_list = [{'a': 1, 'b' : 2, 'c': 3, 'd': 4},
{'a': 1, 'b' : 2, 'c': 5, 'd': 6},
{'a': 9, 'b' : 10, 'c': 11, 'd': 12},
{'a': 9, 'b' : 10, 'c': 13, 'd': 14},
{'a': 9, 'b' : 10, 'c': 15, 'd': 16},
{'a': 17, 'b' : 18, 'c': 19, 'd': 20},
{'a': 1, 'b' : 2, 'c': 7, 'd': 8}]
merge_by_keys = ['a','b']
expected_output_list = [{'a': 1, 'b' : 2, 'other_cols':[{'c': 3, 'd': 4},
{'c': 5, 'd': 6},
{'c': 7, 'd': 8}],
{'a': 9, 'b' : 10, 'other_cols':[{'c': 11, 'd': 12},
{'c': 13, 'd': 14},
{'c': 15, 'd': 16}],
{'a': 17, 'b' : 18, 'other_cols':[{'c': 19, 'd': 20}]}
This looks like what you are looking for:
The most interesting line is:
out[tuple((entry[x],x) for x in merge_by_keys)].append({k: v for k, v in entry.items() if k not in merge_by_keys})
Make sure you understand it. Ask if you have questions.
from collections import defaultdict
data = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
{'a': 1, 'b': 2, 'c': 5, 'd': 6},
{'a': 9, 'b': 10, 'c': 11, 'd': 12},
{'a': 9, 'b': 10, 'c': 13, 'd': 14},
{'a': 9, 'b': 10, 'c': 15, 'd': 16},
{'a': 17, 'b': 18, 'c': 19, 'd': 20},
{'a': 1, 'b': 2, 'c': 7, 'd': 8}]
merge_by_keys = ['a', 'b']
out = defaultdict(list)
for entry in data:
out[tuple((entry[x],x) for x in merge_by_keys)].append({k: v for k, v in entry.items() if k not in merge_by_keys})
result = []
for k, v in out.items():
result.append({})
for x in k:
result[-1][x[1]] = x[0]
result[-1]['other'] = v
for entry in result:
print(entry)
output
{'a': 1, 'b': 2, 'other': [{'c': 3, 'd': 4}, {'c': 5, 'd': 6}, {'c': 7, 'd': 8}]}
{'a': 9, 'b': 10, 'other': [{'c': 11, 'd': 12}, {'c': 13, 'd': 14}, {'c': 15, 'd': 16}]}
{'a': 17, 'b': 18, 'other': [{'c': 19, 'd': 20}]}
here's one way to do it using a dictionary to group entries and turning its values into a list at the end.
input_list = [{'a': 1, 'b' : 2, 'c': 3, 'd': 4},
{'a': 1, 'b' : 2, 'c': 5, 'd': 6},
{'a': 9, 'b' : 10, 'c': 11, 'd': 12},
{'a': 9, 'b' : 10, 'c': 13, 'd': 14},
{'a': 9, 'b' : 10, 'c': 15, 'd': 16},
{'a': 17, 'b' : 18, 'c': 19, 'd': 20},
{'a': 1, 'b' : 2, 'c': 7, 'd': 8}]
merge_keys = ['a','b']
grouped = dict()
for d in input_list:
groupKey = tuple(map(d.get,merge_keys))
groupDict = grouped.setdefault(groupKey,{k:d.pop(k) for k in merge_keys})
groupDict.setdefault('other_cols',[]).append(d)
result = list(grouped.values())
print(result)
[{'a': 1, 'b': 2, 'other_cols': [{'c': 3, 'd': 4},
{'c': 5, 'd': 6},
{'c': 7, 'd': 8}]},
{'a': 9, 'b': 10, 'other_cols': [{'c': 11, 'd': 12},
{'c': 13, 'd': 14},
{'c': 15, 'd': 16}]},
{'a': 17, 'b': 18, 'other_cols': [{'c': 19, 'd': 20}]}]

Concatenate n-values of dictionary to create a new value for a list in Python

I want to create a new value for a new list from n-concatenated values of a dictionary, as strange as it sounds I want something as described below.
I have a dictionary like this:
{'A': 9, 'B': 1, 'C': 2, 'D': 7, 'E': 6, 'F': 8, 'G': 5, 'H': 3, 'I': 4}
{'A': 9, 'B': 1, 'C': 2, 'D': 5, 'E': 3, 'F': 4, 'G': 7, 'H': 6, 'I': 8}
{'A': 7, 'B': 6, 'C': 8, 'D': 9, 'E': 1, 'F': 2, 'G': 5, 'H': 3, 'I': 4}
{'A': 7, 'B': 6, 'C': 8, 'D': 5, 'E': 3, 'F': 4, 'G': 9, 'H': 1, 'I': 2}
{'A': 5, 'B': 3, 'C': 4, 'D': 7, 'E': 6, 'F': 8, 'G': 9, 'H': 1, 'I': 2}
{'A': 5, 'B': 3, 'C': 4, 'D': 9, 'E': 1, 'F': 2, 'G': 7, 'H': 6, 'I': 8}
and I want the result as a new list, for example my_list[0] = ABC values , my_list[1] = DEF values and so on which will be displayed as 912, 768, 534 for the first row of my dictionary. The sorting does matter, it must remain as it is.
I am new to Python 3.x and I cannot find something similar to this problem. All I have achieved is to print the values only, one after another with the below script:
res_list = {frozenset(item.items()) : item for item in my_dictionary}.values()
for x in solutions:
for elem in x.keys():
print(x[elem])
Can I iterate the values and concat them per 3 steps? My goal here is to create a list of 3 digit numbers and compare these values for duplicates so that the result will be in my case just 3 distinct numbers that the sorting here does not matter.
912, 768, 345
I understand that your question may be schematic and so your dictionary keys may not actually be 'A', 'B', 'C' etc.
But given that proviso, does this help?
>>> mydict = {'A': 9, 'B': 1, 'C': 2, 'D': 7, 'E': 6, 'F': 8, 'G': 5, 'H': 3, 'I': 4}
>>> mylist = [int(''.join(str(mydict[k]) for k in group)) for group in ('ABC','DEF','GHI')]
>>> mylist
[912, 768, 534]

comparing dicts with additional values

I have 2 lists of python dicts: realList and expectedList
I want realList to be considered equal to expectedList if there is one, and only one, "sub-dict" on realList for each dict of expectedList
By sub-dict I mean a dict with at least the same key/values, but which might have additional key/values.
so, for example:
realDict = [{'a': 1, 'b': 2}, {'a': 2, 'b': 3}]
==
expectedDict = [{'a': 1}, {'a': 2, 'b': 3}]
realDict = [{'a': 1, 'b': 2}, {'a': 2, 'b': 3}]
!=
expectedDict = [{'a': 2}, {'a': 2, 'b': 3}]
realDict = [{'a': 1, 'b': 2}, {'a': 1, 'b': 3}]
!=
expectedDict = [{'a': 1}]
Any modules to help? Only idea I can think of is iterating over expectedDict and removing a dict from it and from realDict whenever they match. Then, in the end, both must be [].
This works, but I'm unsure how performant it is:
def complete_subset(real_list, expected_list):
real_set_list = [set(d.items()) for d in real_list]
expected_set_list = [set(d.items()) for d in expected_list]
while len(real_set_list):
real_len = len(real_set_list)
i = 0
for real_set in real_set_list:
for expected_set in expected_set_list:
if not len(expected_set - real_set):
real_set_list.remove(real_set)
expected_set_list.remove(expected_set)
i = i + 1
if i == real_len:
break
return (not len(real_set_list)) and (not len(expected_set_list))
Here are my tests:
print complete_subset([{'a': 1, 'b': 2}, {'a': 2, 'b': 3}], [{'a': 1}, {'a': 2, 'b': 3}]) == True
print complete_subset([{'a': 1, 'b': 2}, {'a': 2, 'b': 3}], [{'a': 2}, {'a': 2, 'b': 3}]) == False
print complete_subset([{'a': 1, 'b': 2}, {'a': 2, 'b': 3}], [{'a': 1}]) == False
print complete_subset([{'a': 1, 'b': 2}, {'a': 1, 'b': 2}], [{'a': 1}, {'b': 2}]) == True
print complete_subset([
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
], [
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6},
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5},
{'a': 1, 'b': 2, 'c': 3, 'd': 4},
{'a': 1, 'b': 2, 'c': 3},
{'a': 1, 'b': 2},
{'a': 1},
{'a': 1, 'c': 3, 'd': 4, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'c': 3, 'e': 5, 'f': 6, 'h': 8, 'i': 9, 'j': 10},
{'a': 1, 'b': 2, 'd': 4, 'e': 5, 'g': 7, 'h': 8, 'j': 10},
]) == True
In case your two lists are to be compared element by element, you can do it this way.
def compare(realDict, expectedDict):
if len(readDict) != len(expectedDict):
return False
for d1, d2 in zip(realDict, expectedDict):
for key in d2:
if key not in d1 or d1[key] != d2[key]:
return False
return True

How to sort a complex nested dictionary to a nested list

What is the best way to sort a nested dictionary in Python 2.6 by value? I would like to sort by the length of the inner dictionary followed by the inner dictionary with the largest value. For example:
d = {1: {'AA': {'a': 100, 'b': 1, 'c': 45}},
2: {'AA': {'c': 2}},
3: {'BB': {'d': 122, 'a': 4, 't': 22, 'r': 23, 'w': 12}},
4: {'CC': {'y': 12, 'g': 15, 'b': 500}}}
The desired solution is a nested list:
lst = [[3, 'BB', {'d': 122, 'a': 4, 't': 22, 'r': 23, 'w': 12}],
[4, 'CC', {'y': 12, 'g': 15, 'b': 500}],
[1, 'AA', {'a': 100, 'b': 1, 'c': 45}],
[2, 'AA', {'c': 2}]]
With your corrected data-structure:
d = {1: {'AA': {'a': 100, 'b': 1, 'c': 45}},
2: {'AA': {'c': 2}},
3: {'BB': {'d': 122, 'a': 4, 't': 22, 'r': 23, 'w': 12}},
4: {'CC': {'y': 12, 'g': 15, 'b': 500}}}
def sortkey(x):
num,d1 = x
key,d2 = d1.items()[0] #Some may prefer `next(d.iteritems())`
return len(d2),max(d2.values())
exactly_how_you_want_it = [([k] + v.keys() + v.values()) for k,v in
sorted(d.items(),reverse=True,key=sortkey)]
for item in exactly_how_you_want_it:
print item
results:
[3, 'BB', {'a': 4, 'r': 23, 'd': 122, 'w': 12, 't': 22}]
[4, 'CC', {'y': 12, 'b': 500, 'g': 15}]
[1, 'AA', {'a': 100, 'c': 45, 'b': 1}]
[2, 'AA', {'c': 2}]

Categories

Resources