[Tutor] append index out of range

Walter Prins wprins at gmail.com
Thu Jan 12 15:42:21 CET 2012


Hi

On 12 January 2012 14:38, lina <lina.lastname at gmail.com> wrote:
> Hi,
>
> there is a file
>
> $ cat atom-pair_9.out | wc -l
> 75426
>
> there is 75426 lines there,
>
>    results=[]
>    unique={}
>    for line in open(tobetranslatedfile,"r"):
>        tobetranslatedparts=line.strip().split()
>        results.append(dictionary[tobetranslatedparts[2]])
>
> it complains
>
>    results.append(dictionary[tobetranslatedparts[2]])
> IndexError: list index out of range
>
>
> is it really too large this file?

Read the error message more carefully.  (Hint: It's not saying
anything about the file at all...)

Walter


More information about the Tutor mailing list