close
心情不好,就把這給寫了出來
莊千慧,這東西我想應該可以多少幫助妳一點= =
說明:
這程式會將指定檔案內的英文單字印出且輸出Yahoo奇摩字典針對該單字解說的連結。
假設我有一個單字是below,將會產生以下網址:
http://tw.dictionary.yahoo.com/search?ei=UTF-8&p=below
我也不知道這工具有沒有派上用場的時候.. 加減用吧.. 應該搭配Rails的..
Below is the source code:
print "Please select a file:\n> "; file = gets.chomp
IO.readlines(file).each do |item|
item = item.gsub(/ /, "+")
str = "http://tw.dictionary.yahoo.com/search?ei=UTF-8&p=#{item}"
puts str
File.new("file2.txt", "a").write(str)
end
全站熱搜