Reading from CSV and filtering columns
<p>I have a CSV file.</p>

<p>There are a fixed number of columns and an unknown number of rows. </p>

<p>The information I need is always in the same 2 columns but not in the same row.</p>

<p>When column 6 has a 17 character value I also need to get the data from column 0. </p>

<p>This is an example row from the CSV file:</p>

<pre><code>E4:DD:EF:1C:00:4F, 2012-10-08 11:29:04, 2012-10-08 11:29:56, -75, 9, 18:35:2C:18:16:ED,
</code></pre>

<p>You could open the file and go through it line by line. Split the line and if element 6 has 17 characters append element 0 to your result array.</p>

<pre><code>f = open(file_name, 'r')
res = []
for line in f:
    L = line.split(',')
    If len(L[6])==17:
        res.append(L[0])
</code></pre>

<p>Now you have a list with all the elements in column 6 of you cvs.</p>

python csv