import csv
with open('file.csv', 'rb') as csv_file_to_read, open('file2.csv', 'wb') as csv_file_to_write:
csv_content = csv.reader(csv_file_to_read)
csv_writer = csv.writer(csv_file_to_write, delimiter=' ',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
csv_content = [_ for _ in csv_content]
for i in range(csv_content):
csv_content[i].insert(0, i)
csv_content[i].append(100 + i)
csv_writer.writerow(csv_content)
使用csv库:
相关问题 更多 >
编程相关推荐