Python python二维列表写入文件 思路:求取列表最外层长度求取每个内层列表长度双重for循环进行写入代码:M=[[1,2,3,4,5],[4,5,6,7,8,9],[5,6,7,8,9]]output=open('data.txt','w+')foriinrange(len(M)):forjinrange(len(M[i])):output.write(str(M[i][j]))output.write('')output.write('\n')output.close()运行结果:注意: 系统 2019-09-27 17:46:48 2706