企业400电话
微网小程序
AI电话机器人
电商代运营
全 部 栏 目
企业400电话
网络优化推广
AI电话机器人
呼叫中心
网站建设
商标✡知产
微网小程序
电商运营
彩铃•短信
增值拓展业务
ruby 去掉文件里重复的行
old = File.open(ARGV[0]).collect
new = File.open(ARGV[1],"a+")
for i in 0..old.length-1
new.write(old.uniq[i])
end
##或简单两行也可以如qc.rb
old = File.open(ARGV[0]).collect
puts old.uniq
然后qc.rb dic.dic >new.dic
上一篇:
ruby on rails 代码技巧
下一篇:
Ruby rails 页面跳转(render和redirect_to)
相关文章
ruby 去掉文件里重复的行
old = File.open(ARGV[0]).collect new = File.open(ARGV[1],\"a+\") for i in 0..old.length-1 new.write(old.uniq[i]) end ##或简单两行也可以如qc.rb old = File.open(ARGV[0]).collect puts old.uniq 然后qc.rb dic.dic new.dicruby,去掉,文件,里,重复,...
ruby 去掉文件里重复的行
old = File.open(ARGV[0]).collect new = File.open(ARGV[1],\"a+\") for i in 0..old.length-1 new.write(old.uniq[i]) end ##或简单两行也可以如qc.rb old = File.open(ARGV[0]).collect puts old.uniq 然后qc.rb dic.dic new.dicruby,去掉,文件,里,重复,...
咨 询 客 服