Re: CSV out of range

2012-12-04 Thread Anatoli Hristov
On Tue, Dec 4, 2012 at 2:58 PM, Neil Cerutti wrote: > On 2012-12-04, Anatoli Hristov wrote: >> The issue is now solved I did: >> >> for x in mylist: >> try: >> sku.append(x[4]) >> except IndexError: >> pass >> >> Thank you for your help > > Optionally: > > for x in mylist:

Re: CSV out of range

2012-12-04 Thread Neil Cerutti
On 2012-12-04, Anatoli Hristov wrote: > The issue is now solved I did: > > for x in mylist: > try: > sku.append(x[4]) > except IndexError: > pass > > Thank you for your help Optionally: for x in mylist: if len(x) >= 4: sku.append(x[4]) But do you really need

Re: CSV out of range

2012-12-04 Thread Anatoli Hristov
The issue is now solved I did: for x in mylist: try: sku.append(x[4]) except IndexError: pass Thank you for your help Anatoli -- http://mail.python.org/mailman/listinfo/python-list

Re: CSV out of range

2012-12-04 Thread Anatoli Hristov
On Tue, Dec 4, 2012 at 12:31 PM, Thomas Bach wrote: > 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 >> empty > > Can you provide an example for that? > >> a

Re: CSV out of range

2012-12-04 Thread 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 > empty Can you provide an example for that? > and it seems that there I have empty array, I wanted to ignore the >

CSV out of range

2012-12-04 Thread Anatoli Hristov
Hello, I tried to read a CSV file with 3 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