Python

From neil.tappsville.com
Revision as of 08:07, 3 September 2019 by Gonzo (talk | contribs) (Created page with " ==== Python version of a perl hash ==== <pre> import collections ; def tree() : return collections.defaultdict(tree) hash = tree() hash'outer_key''inner key' = "v...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Python version of a perl hash

import collections

; def tree() : return collections.defaultdict(tree)

hash = tree()

hash[['outer_key']][['inner key']] = "value"


; if not bool(hash) : print "Hash is empty"
; else : print "Hash has some data"