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
Need to parse a HTML table into an Array/hash
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
[QUOTE="Ruby Ronin, post: 4586872"] Note: parts of this message were removed by the gateway to make it a legal Usenet post. I'm kind of new too, so this might be a little sloppy by more experienced standards, but I think this gets you partially there. require "open-uri" conn = open("[URL]http://finance.yahoo.com/q/op?s=AAPL&m=2008-04[/URL]").read table_data = conn.scan /<td.+?td>/ table_data_refined = [] table_data.each { |data| data.gsub!(/<.+?>/, "") table_data_refined << data } You probably need to tweak the regexes to isolate the specific table you want (like plugging in "class=xxx"). I hope that helps. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Need to parse a HTML table into an Array/hash
Top