Re: CSV out of range
On Tue, Dec 4, 2012 at 12:31 PM, Thomas Bach
> Hi there,
> Please be a bit more precise…
> On Tue, Dec 04, 2012 at 12:00:05PM +0100, Anatoli Hristov wrote:
>> The problem comes when I try to index the SKU array and the field is
> Can you provide an example for that?
>> and it seems that there I have empty array, I wanted to ignore the
>> empty arrays using if statement, but it does the same.
> Please provide a small, runable example with the actual code you tried
> that raises the exception and the complete trace back.
> Thomas Bach.
Ok as I said I run a small script, here it is:
>>> import csv
>>> file = open("ShopPrices.csv", "rbU")
>>> reader = csv.reader(file, delimiter=";")
>>> mylist = 
>>> for i in reader:
['19ITN992575', '19I', 'TN', '992575', 'RAB-UP-750-H3', 'Triton 19"
heavy duty 150kg shelf plate 750mm 1U black', '39,93', '0', '', '',
'', '', '', '', '', '', '', '', '']
>>> sku = 
>>> for x in mylist:
Traceback (most recent call last):
File "<stdin>", line 2, in ?
IndexError: list index out of range
It appends all the data till it comes one SKU with empty record ("") .
I tried to use tey and except, but still the same
|All times are GMT. The time now is 12:54 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.