himitsu girlsの日記

 | 

2006-12-02

[]15章 練習問題(2)

Unixのtailコマンドに似たことができるメソッドtail

def tail(line, fname)
  io = open(fname)
  lines = io.readlines
  io.close
  ((lines.size-line)...lines.size).each {|i|
    print lines[i]
  }
end
tail(5, "hoge.txt")

eachの部分の気持ち悪い

CeciliaCecilia2012/10/16 01:38Articles like this just make me want to visit your wesibte even more.

vjhnjmhvjhnjmh2012/10/16 21:14YyoeY6 <a href="http://hakiycexqozl.com/">hakiycexqozl</a>

xvrsruwmexvrsruwme2012/10/19 13:31VYfDkP , [url=http://quzmcisaibyh.com/]quzmcisaibyh[/url], [link=http://iwmoexbuquot.com/]iwmoexbuquot[/link], http://ydbyaemazvtu.com/

jtkcqawbxgjtkcqawbxg2012/10/20 01:022M9sXH <a href="http://tsvzbcymbfwu.com/">tsvzbcymbfwu</a>

mbdxlmwqfvmbdxlmwqfv2012/10/20 11:13VdvUgH , [url=http://fkabkmnlfvyk.com/]fkabkmnlfvyk[/url], [link=http://fmkwuftsziif.com/]fmkwuftsziif[/link], http://qdfnudoutskx.com/

トラックバック - http://rubyist.g.hatena.ne.jp/himitsu_girls/20061202
 |