title: Removing blank spaces from a CSV file without creating a new file
body: <p>I have blank spaces in a csv sheet that I want to get rid of it. </p>
  
  <p>After searching for hours I realized that this is the code for it:</p>
  
  <pre><code>input = open('file.txt', 'wb')
  output = open('new_file.txt', 'wb')
  writer = csv.writer(output)
  for row in csv.reader(input):
      if any(field.strip() for field in row):
          writer.writerow(row)
  input.close()
  output.close()  
  </code></pre>
  
  <p><strong>My question is:</strong> How do I remove the blank spaces without having to create a new file?</p>