| 关键词: old open ARGV File dic uniq collectputs 字典 collectnew new |
作者:lcx 以前合并后台字典时,有重复的都是用vbs去,最近又看了一天的ruby,想起来写一下,没想到代码如此精简: old = File.open(ARGV[0]).collectnew = File.open(ARGV[1],"a+")for i in 0..old.length-1new.write(old.uniq[i])end ##或简单两行也可以如qc.rb old = File.open(ARGV[0]).collectputs old.uniq 然后qc.rb dic.dic >new.dic |
|
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系
[邮箱地址] 删除
|