递归可以很好地解决您的问题。
def convert_to_int(lists): return [int(el) if not isinstance(el,list) else convert_to_int(el) forel in lists]
l2 = ['1','4',['7',['8']],['0','1']] l3 = ['0',['1','5'],['0','1',['8',['0','2']]]] convert_to_int(l2)>>>[1, 4, [7, [8]], [0, 1]] convert_to_int(l3)>>>[0, [1, 5], [0, 1, [8, [0, 2]]]]



