Python将large(10GB).csv转换为.ts

2024-06-03 04:02:33 发布

您现在位置:Python中文网/ 问答频道 /正文

python新手。要将大型csv文件转换为tsv。

import re
with open("D:/AddressEvaluation/NAD/NAD.csv", 'r') as myfile:
with open("D:/NAD.txt", 'w') as csv_file:
for line in myfile:
  fileContent = re.sub(",", "\t", line)
  csv_file.write(fileContent)

我遗漏了什么吗?如果我错了就纠正我。


Tags: 文件csvimportretsvaswithline