Hi all,
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[0], 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('/') playerid.append(breakup[4]) stats = test.findAll(text=True) print len(playerid) ß this shows the expected result print playerid[0] ßthis kills the script 33 print len(playerid) 34 print playerid[0] 35 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[0] to print playerid[1], same error, but if I change it to print playerid[2] 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!
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor