python将字符串list写入excel和txt

本文介绍了如何使用Python将包含多个字符串的列表docs写入Excel和TXT文件。示例中,docs列表包含了多篇论文的标题,分别展示了将这些数据写入两种不同格式文件的方法。
摘要由CSDN通过智能技术生成

docs = [‘icassp improved human face identification using frequency domain representation facial asymmetry’, ‘pattern recognition unsupervised methods classification hyperspectral images low spatial resolution’, ‘iscas post layout watermarking method ip protection’, ‘computers mathematics applications tauberian theorems product method borel cesàro summability’, ‘ieee t. geoscience remote sensing mirs all-weather 1dvar satellite data assimilation retrieval system’]

将docs写入excel

docs = [doc.encode('latin-1', 'ignore') for doc in docs]
# convert list to array
docs_array = np.array(docs)
print(type(docs_array))
# saving...
np.savetxt('/Users/Desktop/portrait/jour_paper_docs.csv', docs_array, fmt='%s', delimiter=',')
print('Finish saving csv file')

结果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值