02. python将list存入csv中的一列

Python的一些应用 jupyter notebook源码

总体思想:将列表变为dataframe再进行转存。

代码:

import pandas as pd

# 假设有列表a
a = ['An attemped build of gfortran from a fresh', 'With a new download of gfortran the build now fails', 'While bootstrapping I noticed.checking for compiler with P', 'define weakexternexpr Pragma expr.', 'Reading the documention at  url  console objdir', 'The 20051227 version of gfortran has 144 new', 'Volker Reichelt  reicheltigpm.', 'javax.security.auth. loginException no configured', 'I was going to do a enablecheckingrelease buil to', 'Allrecursive Error 1.make2  all Error 2', 'libjava fails to build in a cross compiler using newlib', 'Gcc cannot process inlined assembler when configured for power', 'The following testcase..extern int f1 void .', 'The compiler builds but when it tries to build libgcc', 'Gcc 4.2 miscompiles binutils on Linux', 'I just tried to compile Suse package gnomeprint0']
# 将list转为dataframe 显然就变成一列了
d = pd.DataFrame(a) 
d.to_csv('a.csv',index=False,mode='a',header=None) # mode表示追加 在追加时会将列名也作为一行进行追加,故header隐藏表头(列名)

在这里插入图片描述

  • 7
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值