Menu
Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
read CSV file using csv library
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Li Chen" data-source="post: 4613130"><p>Hi all,</p><p></p><p>I need to read a CSV file with csv library. And I tried the example from</p><p>the library.</p><p></p><p>require 'csv'</p><p></p><p>CSV::Reader.parse(File.open('test.csv')) do |row|</p><p>puts row</p><p># break if !row[0].is_null && row[0].data == 'stop'</p><p>end</p><p></p><p>Here is what I got:</p><p>#<CSV::Cell:0x2b7c350></p><p>...</p><p>#<CSV::Cell:0x2b78b4c></p><p></p><p></p><p>I wonder why I can't print out the string/row itself instead of the</p><p>address of the string/row.</p><p></p><p></p><p>Thanks,</p><p></p><p>Li</p></blockquote><p></p>
[QUOTE="Li Chen, post: 4613130"] Hi all, I need to read a CSV file with csv library. And I tried the example from the library. require 'csv' CSV::Reader.parse(File.open('test.csv')) do |row| puts row # break if !row[0].is_null && row[0].data == 'stop' end Here is what I got: #<CSV::Cell:0x2b7c350> ... #<CSV::Cell:0x2b78b4c> I wonder why I can't print out the string/row itself instead of the address of the string/row. Thanks, Li [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
read CSV file using csv library
Top