import csv
ff = open("output.csv","w") # added the line
csvwriter = csv.writer(ff) # added the line
with open(file, "r") as logFile:
reader = csv.reader(logFile,delimiter=" ")
row = []
for line in reader:
col1 = lin[0]
col2 = lin[1]
col3 = int(lin[2]) * 10
row = [col1,col2,col3]
print row
csvwriter.writerow(row) # added the line
del row[:] # added the line
f = [map(int, i.strip('\n').split()) for i in open('thefile.txt')]
new_f = [i[:-1] for i in f]
new_f = [i[:-1]+[i[-1]*10] for i in new_f]
new_file = open('final_file.txt', 'a')
for i in new_f:
new_file.write(' '.join(map(str, i))+"\n")
new_file.close()
附言:只有样品。你知道吗
你可以试试这个:
相关问题 更多 >
编程相关推荐