CSV out of range

Anatoli Hristov tolidtm at gmail.com
Tue Dec 4 06:00:05 EST 2012


Hello,

I tried to read a CSV file with 30000 products in it and index it into
a list using

file = open("ShopPrices.csv", "rbU")
reader = csv.reader(file, delimiter=";")
mylist = []

for x in reader:
    mylist.append(x)

The problem comes when I try to index the SKU array and the field is empty

for sku in mylist:
    print sku[3]

after the 3060 result I'm getting an error:

IndexError: list index out of range

and it seems that there I have empty array, I wanted to ignore the
empty arrays using if statement, but it does the same.

Thanks

Anatoli



More information about the Python-list mailing list