我有一个变量叫做
anime_dict
which contains a dictionary of lists of objects as shown below.
{'JI2212': ('Inu Yasha', [('year', 1992), ('rating', 3)]), 'EH389J': (Naruto', [('year', 1994), ('rating', 4), ('readers', 3424322)]), 'PPP67': ('Fruits Basket', [('Year', 1999), ('rating', 5), ('readers', 434232), ('chap', 40)])}
so the key of the dict is the 1st part ('JI2212' for Inu Yasha), the 2nd part is the name and the last part contains a list of parts.
I want to create 2 functions that would 1st get the key from the given name and 2nd get the parts from the given name.
the functions would be...
get_key(name)
and get_parts(name)
例如
>>>get_key('Fruits Basket')
'PPP67'
and
>>>get_parts('Inu Yasha')
[('year', 1992), ('rating', 3)]