Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34215 > unrolled thread

CSV out of range

Started byAnatoli Hristov <tolidtm@gmail.com>
First post2012-12-04 12:00 +0100
Last post2012-12-04 12:00 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  CSV out of range Anatoli Hristov <tolidtm@gmail.com> - 2012-12-04 12:00 +0100

#34215 — CSV out of range

FromAnatoli Hristov <tolidtm@gmail.com>
Date2012-12-04 12:00 +0100
SubjectCSV out of range
Message-ID<mailman.456.1354618808.29569.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web