[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: #help in reading from csv file

James Gray

12/7/2006 2:25:00 PM

On Dec 6, 2006, at 11:58 PM, Tanushree Bhoi wrote:

> # iterate to the csv file row by row till there is any row exists.
>
> while(row=product.shift)
> create_product(row)

create_product(row) unless row.empty?

> end

> Here in this code it is reading one extra empty row from the file
> how to
> handle that in ruby.
> I want to control the loop where there is no more rows in the csv
> file.
> Can anybody helps.Help will be highly appreciated.

I suspect there is an empty line in your file. If so, the above fix
should help.

James Edward Gray II