[Tutor] String Attribute
Emile van Sebille
emile at fenx.com
Sat Aug 1 01:16:36 CEST 2015
On 7/31/2015 11:57 AM, ltc.hotspot at gmail.com wrote:
> →Question: Why is the list index out of range on line # 9:
>
> IndexError
>
> Traceback (most recent call last)
> C:\Users\vm\Desktop\apps\docs\Python\assinment_8_5_v_20.py in <module>()
> 7 line2 = line.strip()
> 8 line3 = line2.split()
> ----> 9 line4 = line3[1]
> 10 addresses.add(line4)
> 11 count = count + 1
> IndexError: list index out of range
>
Because line3 is not sub-scriptable.
Have you examined what line3 holds when the error occurs?
Emile
More information about the Tutor
mailing list