From: Pen Ttt Date: 2010-03-30T20:16:36+09:00 Subject: Re: how to use string variables in output files? think for your help the right code is : require 'hpricot' require 'open-uri' require 'iconv' data =open('http://quotes.money.163.com/corp/1034/code=601398.html').read html = Iconv.iconv("UTF-8//IGNORE","GB2312//IGNORE",data) u8doc = Hpricot(html[0]) tables = u8doc.search("table") i=tables.size for j in 0..i-1 output = File.new("/home/pt/test/table" + j.to_s + ".html", "w") output.puts tables[j].inner_html output.close end i still have some problems: 1\when i got the table's html,for example tables[2], can i get row size or column size of the tables[2]. 2\can i use array to load the data in the tables[2]?? -- Posted via http://www.ruby-forum.com/.