假设我有一个包含多个列表和元组的字典,我想循环遍历所有字典的项目,并且还遍历所有字典的元组和列表(以便只获取值和关键字)有没有办法做到这一点,而不仅仅是定义一堆for循环?
即:
def islist(arg):
if type(arg) == list or tuple:
#loop
for i in arg:
if type(i) == list or tuple:
#again
for i in arg:
if type(i) == list or tuple:
#again