python -- question with list.pop(0)

David Stockwell winexpert at hotmail.com
Mon Jun 7 14:06:28 CEST 2004


Hi,

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.

code snippet:
--- begin snippet --

          ourFile = open(fileNamesList[0],'r')
          strData = ourFile.read()
          ourFile.close()

          records = []

          #
          # do we need to use \r\n????
          #

	  print "split 0.5"
          records.append(strData.split("\n"))
	  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?

Thanks


David
-------
Tracfone: http://cellphone.duneram.com/index.html
Cam: http://www.duneram.com/cam/index.html
Tax: http://www.duneram.com/index.html

_________________________________________________________________
Watch the online reality show Mixed Messages with a friend and enter to win 
a trip to NY 
http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/01/





More information about the Python-list mailing list