Filtering data out of Excel file via CSV
<p>Is there eny alternative for this than making multiple for loop ? </p>

<p>I have an Excel file : </p>

<pre><code>|col1|col2|col3|
 1      x   y   
 2      s   r 
 3     o    o 
</code></pre>

<p>I want an output like this:  When first column argument equals 1, print argument from column 3 from the same row.</p>

<pre><code>import csv


reader = csv.reader(open("alerts.csv"), delimiter=',')

rows=[]
for row in reader:
    rows.append(row)
for i in row:
    x"i"?=row[i].split(";")
</code></pre>

<p>I'm trying to figure out a function that would make another list with split information form <code>row[i]</code> but that wont work I feel. </p>

<p>So i have difrent idea to sort everything out to diffrent list. </p>

<pre><code>import csv


reader = csv.reader(open("alerts.csv"), delimiter=',')

rows=[]
for row in reader:
    rows.append(row)

num_lists=int(len(rows))


lists = []
for p in range(num_lists):
        lists.append([])


for i in rows:
    lists[i][i]=row[i].split(";")

print (lists[0][0])
</code></pre>

<p>but that seems not work :&lt; </p>

python excel csv