<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>Hi all, <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>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 don’t see the issue with this one?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I’ve 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.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>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 5<sup>th</sup>
value, which I am then adding to the playerid array.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>playerid = []<o:p></o:p></p>
<p class=MsoNormal> for
i in range(0, players):<o:p></o:p></p>
<p class=MsoNormal> player
= playerlink[i]['href'] <o:p></o:p></p>
<p class=MsoNormal> breakup
= player.split('/')<o:p></o:p></p>
<p class=MsoNormal> playerid.append(breakup[4])<o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal> stats
= test.findAll(text=True)<o:p></o:p></p>
<p class=MsoNormal> print
len(playerid) <span style='font-family:Wingdings'>ß</span> this shows the
expected result<o:p></o:p></p>
<p class=MsoNormal> print
playerid[0] <span style='font-family:Wingdings'>ß</span>this kills the
script<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%"
style='width:100.0%'>
<tr>
<td style='padding:0in 0in 0in 0in'>
<p class=MsoNormal><span style='font-size:7.5pt;font-family:"Courier New";
color:#909090'> 33</span><span style='font-size:10.0pt;
font-family:"Courier New";color:#909090'> print len(playerid)</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style='background:#FFCCEE;padding:0in 0in 0in 0in'>
<p class=MsoNormal><span style='font-size:7.5pt;font-family:"Courier New"'> 34</span><span
style='font-size:10.0pt;font-family:"Courier New"'> print playerid[0]</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style='padding:0in 0in 0in 0in'>
<p class=MsoNormal><span style='font-size:7.5pt;font-family:"Courier New";
color:#909090'> 35</span><span style='font-size:10.0pt;
font-family:"Courier New";color:#909090'> </span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style='padding:0in 0in 0in 0in'></td>
</tr>
<tr>
<td style='padding:0in 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Times New Roman","serif";
color:#909090'>playerid</span></b><span style='font-size:10.0pt;font-family:
"Times New Roman","serif";color:#909090'> = []</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</td>
</tr>
</table>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><type
'exceptions.IndexError'></span></b><span style='font-size:12.0pt;font-family:
"Times New Roman","serif"'>: list index out of range <br>
</span><span style='font-size:7.5pt;font-family:"Courier New"'> </span><span
style='font-size:10.0pt;font-family:"Courier New"'> </span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'>args =
('list index out of range',) <br>
</span><span style='font-size:7.5pt;font-family:"Courier New"'> </span><span
style='font-size:10.0pt;font-family:"Courier New"'> </span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'>message =
'list index out of range' <o:p></o:p></span></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'>If I change the </span>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.<span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'>Any help would
be appreciated, thank you!<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>