0

I've seen some threads on this, but none seem to be simple. I'm looking for a simple code to remove the blank rows in a CSV using python.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Code4Days
  • 131
  • 1
  • 1
  • 10

1 Answers1

1

Alternatively (to the duplicate question) you can consider using grep

grep -Pv ^,*$ input_file.csv > output_file.csv

e.g. any line in input_file.csv that is not either blank or solely composed of commas get redirected to output_file.csv

Adam Smith
  • 52,157
  • 12
  • 73
  • 112