python,将双嵌套列表写入csv文件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/littlle_yan/article/details/82956628
import pandas as pd
def write_csv(datalist,path):
    test=pd.DataFrame(data=datalist)
    test.to_csv(path, encoding='gbk')
    return test
total=[[1,2,3],[4,5,6],[7,8,9]]
path='E:\h_o.csv'
write_csv(total,path)

生成的csv文件内容如图所示:

如果不需要行号,列号可以直接选中整行整列删除即可。

猜你喜欢

转载自blog.csdn.net/littlle_yan/article/details/82956628
今日推荐