小编B_R*_*B_R的帖子

如何使用python将csv文件转换为文本文件?

我想使用python将几个.csv文件转换为.txt文件.在我的.csv文件中,我有数百行数据,如下图: csv文件的图像

Value   Date    Time
919     4/15/2016   19:41:02
551     4/15/2016   19:46:51
717     4/15/2016   19:49:48
2679    4/15/2016   19:52:49
2890    4/15/2016   19:55:43
2897    4/15/2016   19:58:38
1790    4/15/2016   21:39:14
2953    4/15/2016   21:42:10
2516    4/15/2016   21:45:04
2530    4/15/2016   21:47:58
2951    4/15/2016   21:51:02
2954    4/15/2016   21:53:56
2537    4/15/2016   21:56:52
2523    4/15/2016   21:59:45
2536    4/15/2016   22:02:49
2727    4/15/2016   22:05:43
Run Code Online (Sandbox Code Playgroud)

我为此目的使用波纹管代码.

csv_file = input('Enter the name of your input file: ')
txt_file = input('Enter the name of your output file: ')

text_list = []

with open(csv_file, "r") …
Run Code Online (Sandbox Code Playgroud)

python csv text

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

csv ×1

python ×1

text ×1