join separate files with python
<p>I want to join 100 differeant files into one.</p>

<p>Example of file with data:</p>

<p>example1.txt has in this format:</p>

<pre><code>  something
  something 
  somehting
</code></pre>

<p>example2.txt has in this format:</p>

<pre><code> something
 something 
 somehting
</code></pre>

<p>and all the 100 files have the same format of data and also have a common name example1.....example100 which mean the example is the same and have a number.</p>

<pre><code>from itertools import chain


 infiles = [open('{}_example.txt'.format(i+1), 'r') for i in xrange(113)]
 with open('example.txt', 'w') as fout:
      for lines in chain(*infiles):
            fout.write(lines)
</code></pre>

<p>I used this but the problem is the first line of the next file joined with the last of the previous file</p>
