From: Pen Ttt Date: 2010-03-30T09:58:44+09:00 Subject: how to use string variables in output files? hi,i want to prase the web 'http://quotes.money.163.com/corp/1034/code=601398.html' there are 27 tables in the web, i made a for loop to get every table in the web, /home/pt/test/table0 is the output of tables[0], /home/pt/test/table1 is the output of tables[1], ,,,,, /home/pt/test/table26 is the output of tables[27], here is my programme, 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 puts i for j in 0..i-1 File.open('/home/pt/test/table'+j.to_s+'.html', 'w') {|f| f.write('tables['+j.to_s+']'.inner_html) } end it can't work,can you revise it for me? think you -- Posted via http://www.ruby-forum.com/.