I often find myself in situations where I need to cross and parse a semi-complex JSON structure . During the translators, some dictionaries are expected for the Any remaining key / value that will need to be individually mapped to an object ( Is there a combination of build-in functions to simplify such traversal, mapping and isolation, making it more dynamic and Pythonic? You can use the key , and their
value is appropriate in an object (
foo. Mapping is required. .
foo.additional_attributes (** remaining) ) and it Variable keys can be controlled as / value attributes.
pop method of the dictionary: >
for the key in the required_keys: foo __dict __ [key] = d.pop (key) foo.additional_attributes (** d)
Comments
Post a Comment