file = "epi4.txt"
def modi(x)
((((x * 1000) + 25) / 50).to_i * 50.0) / 1000.0
end
###############################################
f = open(file)
out_file = file[0..-4] + "mod"
out = open(out_file,"w")
10.times{out.puts f.gets}

while str = f.gets
  if /^L/ =~ str
    out.puts str
    v = str.split
    n = v[1].to_i
    n.times do
      xy = f.gets.chop.split
      out.printf " %.2f %.2f\n",modi(xy[0].to_f),modi(xy[1].to_f)
    end
    out.puts f.gets
  end
end
f.close; out.close

タグ:

+ タグ編集
  • タグ:
最終更新:2007年06月13日 17:53