CSV out of range

  • Thread starter Anatoli Hristov
  • Start date
A

Anatoli Hristov

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top