Skip to content

Instantly share code, notes, and snippets.

@rockydd
Created September 30, 2010 07:44
Show Gist options
  • Save rockydd/604189 to your computer and use it in GitHub Desktop.
Save rockydd/604189 to your computer and use it in GitHub Desktop.
# h = [["a", 100], ["c", 300], ["d", 400]] 怎么转化成 {"c" => 300, "a" => 100, "d" => 400, "c" => 300 }这样一个hash
h.flatten!
Hash[*h]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment