Multiple editing of CSV files
<p>I have a small delay with operating CSV files in python (3.5). Previously I was working with single files and there was no problem, but right now I have >100 files in one folder.
So, my goal is:</p>

<ol>
<li>To parse all *.csv files in the directory</li>
<li><p>From each file delete first 6 rows , the files consists of the following data:</p>

<pre class="lang-none prettyprint-override"><code>"nu(Ep), 2.6.8"
"Date: 2/10/16, 11:18:21 AM"
19
Ep,nu
0.0952645,0.123776,
0.119036,0.157720,
...
0.992060,0.374300,
</code></pre></li>
<li><p>Save each file separately (for example adding <code>"_edited"</code>), so there should be only numbers saved.</p></li>
<li>As an option - I have data subdivided on two parts for one material. For example: <code>Ag(0-1_s).csv</code> and <code>Ag(1-4)_s.csv</code> (after steps 1-3 the should be like <code>Ag(*)_edited.csv</code>). How can I merge this two files in a way of adding data from (1-4) to the end of (0-1) saving it in a third file?</li>
</ol>

<p>My code so far is the following:</p>

<pre><code>import os, sys
import csv
import re
import glob
import fileinput


def get_all_files(directory, extension='.csv'):
    dir_list = os.listdir(directory)
    csv_files = []
    for i in dir_list:
        if i.endswith(extension):
            csv_files.append(os.path.realpath(i))
    return csv_files

csv_files = get_all_files('/Directory/Path/Here')

#Here is the problem with csv's, I dont know how to scan files
#which are in the list "csv_files".

for n in csv_files:
    #print(n)
    lines = [] #empty, because I dont know how to write it properly per
               #each file
    input = open(n, 'r')
    reader = csv.reader(n)
    temp = []
    for i in range(5):
        next(reader)
        #a for loop for here regarding rows?
        #for row in n: ???
        #  ???
    input.close()
    #newfilename = "".join(n.split(".csv")) + "edited.csv"
    #newfilename can be used within open() below:
    with open(n + '_edited.csv', 'w') as nf:
        writer = csv.writer(nf)
        writer.writerows(lines)
</code></pre>