def get_dictionaries(list_obj):
for item in list_obj:
if type(item) == list:
for x in get_dictionaries(item):
yield x
elif type(item) == dict:
yield item
else:
raise ValueError("unexpected item type (not a list or a dictionary)")
用途:
top_level_list = [{......
for x in get_dictionaries(top_level_list):
print x
用途:
相关问题 更多 >
编程相关推荐