[Tutor] Python List Help
mike at fozzil.net
Mon Oct 19 17:24:32 CEST 2009
I am a PHP developer that just started learning Python for a specific
application and the transition has been pretty easily assisted by google,
but I just dont see the issue with this one?
Ive got a list that created and populate in a loop that shows the correct
info when I print it, but if I try to print array, it says the list index
is out of range.
Here is the code snippet. Basically, I have a link here that I am pulling
the href info from and splitting it up, only keeping the 5th value, which I
am then adding to the playerid array.
playerid = 
for i in range(0, players):
player = playerlink[i]['href']
breakup = player.split('/')
stats = test.findAll(text=True)
print len(playerid) ß this shows the expected result
print playerid ßthis kills the script
33 print len(playerid)
34 print playerid
playerid = 
<type 'exceptions.IndexError'>: list index out of range
args = ('list index out of range',)
message = 'list index out of range'
If I change the print playerid to print playerid, same error, but if I
change it to print playerid or higher, it will show the same error, but
the playerid=  will show the actual list values in the debug.
Any help would be appreciated, thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor