请尽量用简洁的方法将二维数组转换成一维数组 例: 转换前 lst=[[1,2,3],[4,5,6],[7,8,9]] 转换后lst = [1,2,3,4,5,6,7,8,9]
""" 方法一: lst=[[1,2,3],[4,5,6],[7,8,9]] a = sum(lst,[]) print(a) 方法二: from tkinter import _flatten lst=[[1,2,3],[4,5,6],[7,8,9]] t = list(_flatten(lst)) print(t) 方法三: from itertools import chain lst=[[1,2,3],[4,5,6],[7,8,9]] print(list(chain.from_iterable(lst))) """