title: How to split each value in a column as a seperate csv file in Python?
body: <p>I have a column like this in a csv file:</p>
  
  <pre><code>-----
  label
  -----
  0
  1
  0
  2
  1
  4
  3
  0
  </code></pre>
  
  <p>Now I need to write each value as a different CSV files that is:</p>
  
  <pre><code>0.csv
  1.csv
  ...
  7.csv
  </code></pre>
  
  <p>I have tried with the folowing code that can write each line on a single csv file:</p>
  
  <pre><code>import re
  test_f = open('test.csv')
  result_f = open('result.csv', 'a')
  for line in test_f:
      new_str = re.sub('[^a-zA-Z0-9\n\.]'," ", line)
      result_f.write(new_str)
  
  # also, this too, please:
  test_f.close()
  result_f.close()
  </code></pre>
  
  <p>But I don't know how to save each line in a different file. Any better sugestion, please? </p>