CSV split rows into lists
<p>So i would like to split string from list into multiple lists 
like rows[1] should be splited into another list contained in list m
i saw this here and it hsould be accesable m[0][0] to get first item form first list . 
    import csv</p>

<pre><code>reader = csv.reader(open("alerts.csv"), delimiter=',')
)
rows=[]
for row in reader:
    rows.append(row)

num_lists=int(len(rows))
lists=[]


m=[]

for x in rows:
    m.append(x.split(';')[0])
</code></pre>

<p>printing rows: </p>

<pre><code>[['priority;status;time;object_class;host;app;inc;tool;msg'], ['P2;CLOSED;24-09-2016 20:06:41;nm;prod;;390949;HPNNM;call'], ['P2;CLOSED;24-09-2016 20:06:41;nm;prod;;390949;HPNNM;msg'], ['P2;CLOSED;24-09-2016 20:06:41;nm;prod;;390949;HPNNM;msg']]
</code></pre>

<p>and output should look like 
m[0][0] should return pririty </p>

<p>you can do this pretty easily with pandas</p>

<pre><code>import pandas as pd
A = pd.read_csv('yourfile.csv')

for x in A.values:
    for y in x:
        print y
</code></pre>

<p>so the 'print y' statement access each element in the row.  but I  mean, after the "for x in A.values" you can do just about anything</p>

python list csv