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


Groups > comp.lang.python > #34215

CSV out of range

Date 2012-12-04 12:00 +0100
Subject CSV out of range
From Anatoli Hristov <tolidtm@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.456.1354618808.29569.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web