L
Li Chen
Hi all,
I query a website,extract some info from fetched page, and save/write
the info in txt format. My current problem: I can print all the info to
the screen but only the last line is written/saved to the file. I wonder
what is going on.
Thanks,
Li
##here is the code line to print the results to the screen and save to
the file
File.open('test.txt','w'){|f| puts e.inner_text; f.puts e.inner_text}
##screen results:
abacus
(n.)
A manual computing device consisting of a frame holding parallel rods
strung with movable counters.
abacus
(n.)
A slab on the top of the capital of a column.
## written/saved file
A slab on the top of the capital of a column.
I query a website,extract some info from fetched page, and save/write
the info in txt format. My current problem: I can print all the info to
the screen but only the last line is written/saved to the file. I wonder
what is going on.
Thanks,
Li
##here is the code line to print the results to the screen and save to
the file
File.open('test.txt','w'){|f| puts e.inner_text; f.puts e.inner_text}
##screen results:
abacus
(n.)
A manual computing device consisting of a frame holding parallel rods
strung with movable counters.
abacus
(n.)
A slab on the top of the capital of a column.
## written/saved file
A slab on the top of the capital of a column.