python -- question with list.pop(0)
winexpert at hotmail.com
Mon Jun 7 14:06:28 CEST 2004
I'm getting an error 'oops an error pop from an empty list'
However I am printing the contents of the list right before i am attempting
the pop and there are items in the list.
The weird thing is the list looks different than i expect it to be.
--- begin snippet --
ourFile = open(fileNamesList,'r')
strData = ourFile.read()
records = 
# do we need to use \r\n????
print "split 0.5"
print "records '%s'" % records
=== end snippet ====
at this point the output looks like this
'[['this is line 1', 'this is line 2', 'this is line 3', '' ]]'
I don't understand why two [[ list symbols are showing up, its like its a
list of lists?
Then when I attempt to pop the first element I get the error.
Probably the problem is somehow related to having [ [ ??
What am I doing wrong?
Watch the online reality show Mixed Messages with a friend and enter to win
a trip to NY
More information about the Python-list