转载 | Python中多层List展平为一层
参考:Python中多层List展平为一层使用Python脚本的过程中,偶尔需要使用list多层转一层,又总是忘记怎么写搜索关键词,所以总是找了很久,现在把各种方法记录下来,方便自己也方便大家.方法很多,现在就简单写8种,后面再对这8种方法做基准测试.声明:文中的方法均收集自Making a flat list out of list of lists in Pythonimport functoolsimport itertoolsimport numpyimport operatori