【发布时间】:2017-02-11 23:03:16
【问题描述】:
import csv
with open("HORSES.csv") as f:
for row in csv.reader(f):
# Number of pages plus one
for horse in row:
print (horse)
with open("%s.txt" % horse, "w") as f:
f.close()
此内容文件 horses.csvwest,usa,asia,black。输出操作系统很好,但是对于创建 .txt 文件仅 black.txt 文件结尾 horses.csv 不从列表 pd csv 文件创建文件 txt,如何使用来自列表文件 horses.csv 的文件名创建 .txt 文件,就像这样 west.txt usa.txt asia.txt black.txt
【问题讨论】:
标签: python python-2.7 csv