[Tutor] append index out of range
bgailer at gmail.com
Thu Jan 12 15:48:33 CET 2012
On 1/12/2012 9:38 AM, lina wrote:
> there is a file
> $ cat atom-pair_9.out | wc -l
> there is 75426 lines there,
> for line in open(tobetranslatedfile,"r"):
> it complains
> IndexError: list index out of range
> is it really too large this file?
This has nothing to do with the size of the file. It means Python
encountered a line in the file with less than 3
List indexing starts at 0, so tobetranslatedparts refers to the 3rd
item of the list that was created by split().
If that does not help, please show us some sample lines.
Chapel Hill NC
More information about the Tutor