title: How to transform a list into a hierarchy dict
body: <p>How would I turn a list like <code>["one","two","three","four"]</code> into something like <code>{"one": {"two": {"three":{"four"}}}}</code> where each item in the list would be a descendant of the other element in the dictionary? I think it could be done in a recursive function, but I'm not sure how.</p>
  
  <p>This is what I tried:</p>
  
  <pre><code>l = ["one","two","three","four"]
  d = {}
  
  for v in l[:-1]:
      d[v] = {l}
      d = d[v]
  
  print(d)
  </code></pre>
  
  <p>Thanks!</p>