python - How to remove a cell of certain value from a CSV file -


i've csv file has got single cell @ last row. need find delete. e.g.

total1254612

the value of total won't same time causing problem.

you can leverage fact know there 1 value , first 5 letters 'total'. rewrite lines don't meet these conditions new file:

f_original = open(fname, 'r') f_new = open(fname+'_new.csv', 'w')  #iterate through lines line in f_original:     if line.startswith('total'):         f_new.write(line)  f_original.close() f_new.close() 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -