title: how to swap rows in csv file with python?
body: <p>I have 11k csv files where I have only two rows they look like this </p>
  
  <pre><code>---------------------------
               | A0.31       |
  ---------------------------
  some data    |             |
  ---------------------------
  </code></pre>
  
  <p>and I want them in one only row</p>
  
  <pre><code>---------------------------
  some data    | A0.31       |
  ---------------------------
  
  </code></pre>
  
  <p>I have this code but it just replaces the values not putting them in one row</p>
  
  <pre><code>import csv, os
  
  with open('path/to/filename') as inf, open('path/to/filename_temp', 'w') as outf:
      reader = csv.reader(inf)
      writer = csv.writer(outf)
      for line in reader:
          if line[1] == '0':
             ...
          ... # as above
  
  os.remove('path/to/filename')
  os.rename('path/to/filename_temp', 'path/to/filename')
  </code></pre>