title: How to insert lines into csv file with python
body: <p>I have 2 files " CSV " </p>
  
  <p>i want to insert the lines from the first file into the second file </p>
  
  <p>how to insert specific numbers of lines like example the first 10 lines 
  and also how to insert the all file </p>
  
  <p>how to do this with python ?</p>
  
  <p>for example : </p>
  
  <p>First file include : </p>
  
  <pre><code>1 , A
  2 , B
  3 , C
  
  </code></pre>
  
  <p>Second file include :</p>
  
  <pre><code>4 , D
  </code></pre>
  
  <p>i want to add the lines from the first file to the second file so second file will be like this :</p>
  
  <pre><code>4 , D
  1 , A
  2 , B
  3 , C
  </code></pre>
  
  <p>This is the code i use :</p>
  
  <pre><code>outfile = open("second.csv", "w", encoding="utf8")
  for line in open("first.csv", "r", encoding="utf8"):
       outfile.write(line)
  outfile.close()
  </code></pre>
  
  <p>But the problem in my code is not insert more lines the code delete what in second file and then insert into it what in the first file ( what i want is to insert lines without delete what was in the second file ) </p>