1 li = [1, 2, 3, [3, [...]]] 2 for i in li: 3 # 判断该元素是不是可迭代对象, 如果是就行相关操作 4 if isinstance(i, (list, tuple, str, dict)): 5 ....
1 li = [1, 2, 3, [3, [...]]] 2 for i in li: 3 # 判断该元素是不是可迭代对象, 如果是就行相关操作 4 if isinstance(i, (list, tuple, str, dict)): 5 ....