Weird python behaviour with list of dictionaries
<p>I have a list of dictionaries <code>listEntries</code>. When I say <code>print listEntries</code> in IPython, I get the following output.</p>

<pre><code>[{'div': ' ',
  'id': '   EE 760 ',
  'instructor': 'Narayanan H.',
  'instructor_type': 'I ',
  'name': 'Advanced Network Analysis',
  'slot': '3 ',
  'student': '28'},
 {'div': ' ',
  'id': '   EE 764 ',
  'instructor': 'Karandikar Abhay',
  'instructor_type': 'I ',
  'name': 'Wireless &amp; Mobile Communication',
  'slot': '1 ',
  'student': '36'}]
</code></pre>

<p>But when I do <code>a = listEntries[0]</code> following by <code>print a</code> all I get is <code>{}</code>. </p>

<p>UPDATE : When I use pop method, I get the expected behaviour. I have created this list by parsing a csv file. </p>

<p>Here is the code.</p>

<pre><code>import os
import csv

file1 = open('./data.txt', 'r');
csv1 = csv.reader(file1);
listEntry = list();
for row in csv1 :
    # if first row is a number then this row represent course.
    course = {}
    if row[0].isdigit() :
        course['id'] = row[1]
        course['name'] = row[2]
        course['instructor'] = row[3]
        course['instructor_type'] = row[4]
        course['slot'] = row[5]
        course['div'] = row[6]
        course['student'] = row[7]
    else : pass
    listEntry.append(course);

print listEntry[0]
</code></pre>

<p>Here is file data.txt which I am parsing. I am using python2.7</p>

<pre><code>"Running courses for year 2005-2006 and semester 2 "
"   1991-1992  1992-1993  1993-1994  1994-1995  1995-1996  1996-1997  1997-1998  1998-1999  1999-2000  2000-2001  2001-2002  2002-2003  2003-2004  2004-2005  2005-2006  2006-2007  2007-2008  2008-2009  2009-2010  2010-2011  2011-2012  2012-2013    1 - Autumn 2 - Spring 3 - Summer 4 - winter     "
"Instructor Status A=Associate"
"Sr no.","Course Code","Course Name","Instructor Name","Instructor Status","Slot","Division","Enrolled students","Biometric Attendance Enabled?","Registration Limit","Restrictions","Division"
"67","   EE 760 ","Advanced Network Analysis","Narayanan H.","I ","3 "," ","28","-","0","",""
"68","   EE 764 ","Wireless &amp; Mobile Communication","Karandikar Abhay","I ","1 "," ","36","-","0","",""
</code></pre>
