Difference between revisions of "Python"

From neil.tappsville.com
Jump to navigationJump to search
(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...")
(No difference)

Revision as of 08:07, 3 September 2019

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"