1

我有

hash1 = {:sym1 => "aaa", :sym2 => "bbb"}
hash2 = {:sym20 => "ccc", :sym21 => "ddd"}

怎么做

hash1 = {:sym1 => "aaa"}
hash2 = {:sym2 => "bbb", :sym20 => "ccc", :sym21 => "ddd"}
4

1 回答 1

5
hash2[:sym2] = hash1.delete(:sym2)
于 2012-05-26T08:00:51.063 回答