Python load list in list from text file
<p>I want to load list in list from text file. I went through many examples but no solution. This is what I want to do
I am new bee to python</p>

<pre><code>def main()
    mainlist = [[]]
    infile = open('listtxt.txt','r')
    for line in infile:
        mainlist.append(line)

    infile.close()

    print mainlist

`[[],['abc','def', 1],['ghi','jkl',2]]`
</code></pre>

<p>however what I want is something like this</p>

<pre><code>[['abc','def',1],['ghi','jkl',2]]
</code></pre>

<p>my list contains</p>

<pre><code>'abc','def',1
'ghi','jkl',2
'mno','pqr',3
</code></pre>

<p>what I want is when I access the list 
<code>print mainlist[0]</code>
should return</p>

<pre><code>'abc','def',1
</code></pre>

<p>any help will be highly appreciated
Thanks,</p>
