0
而不是使用output.csv如果我想有类别列表单词是文件名。我试过,但它不工作。如何让python读取csv文件并提取数据并粘贴另一个csv?
import csv
handle_w = open('output.csv', 'wb')
csv_out = csv.writer(handle_w, delimiter=' ')
csv_out.writerow([" ", "Waybill", "Contents", " ", "Amount", "COD Amount", "Type", " ", "Error"])
with open('ss.csv') as handle2:
for each in handle2:
j = each
print j
strng_conv = ''.join(map(str,j))
file_name = strng_conv+'.csv'
print file_name
cat_file = open(file_name,'wb')
cat_var =csv.writer(cat_file,delimiter=' ')
with open('1.csv', 'rb') as csvfile:
handle1 = csv.reader(csvfile, delimiter=' ')
for row in handle1:
if each.rstrip() in row:
cat_var.writerow(row)
cat_file.close()
handle_w.close()
不,它不是一门功课,其analysis.It任务是不工作的权利 – nik 2015-02-11 09:32:36
现在是固定的。我试过 – gunzapper 2015-02-11 10:02:13
谢谢,如果iI想要创建文件并将它们放入与尊敬的名称匹配的内容中,我将如何实现它? – nik 2015-02-11 10:06:49