Quantcast
Viewing latest article 27
Browse Latest Browse All 40

Answer by nehem for How to use a dot "." to access members of dictionary?

def dict_to_object(dick):    # http://stackoverflow.com/a/1305663/968442    class Struct:        def __init__(self, **entries):            self.__dict__.update(entries)    return Struct(**dick)

If one decides to permanently convert that dict to object this should do. You can create a throwaway object just before accessing.

d = dict_to_object(d)

Viewing latest article 27
Browse Latest Browse All 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>