How to use the dotmap.__init__.DotMap.fromkeys function in dotmap

To help you get started, we’ve selected a few dotmap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github drgrib / dotmap / dotmap / __init__.py View on Github external
if __name__ == '__main__':
    # basics
    print('\n== basics ==')
    d = {
        'a':1,
        'b':2,
        'subD': {'c':3, 'd':4}
    }
    dd = DotMap(d)
    print(dd)
    print(len(dd))
    print(dd.copy())
    print(dd)
    print(OrderedDict.fromkeys([1,2,3]))
    print(DotMap.fromkeys([1,2,3], 'a'))
    print(dd.get('a'))
    print(dd.get('f',33))
    print(dd.get('f'))
    print(dd.has_key('a'))
    dd.update([('rat',5),('bum',4)], dog=7,cat=9)
    dd.update({'lol':1,'ba':2})
    print(dd)
    print
    for k in dd:
        print(k)
    print('a' in dd)
    print('c' in dd)
    dd.c.a = 1
    print(dd.toDict())
    dd.pprint()
    print

dotmap

ordered, dynamically-expandable dot-access dictionary

MIT
Latest version published 3 years ago

Package Health Score

58 / 100
Full package analysis

Similar packages