python递归遍历多维数组

new_list = ["H1", "H2", 1999, ["hello", "day", ["a", "b"]]]


def loop_multi_array(list_string):
    for list_value in list_string:
        if isinstance(list_value, list):
            loop_multi_array(list_value)
        else:
            print(list_value, end='# ')


loop_multi_array(new_list)

你可能感兴趣的:(python,python,递归算法,多维数组)