Skip to content

Instantly share code, notes, and snippets.

@AnjaneyuluBatta505
Created January 25, 2018 12:48
Show Gist options
  • Save AnjaneyuluBatta505/aa1d3e87c23b3ee327c37ff56b89b780 to your computer and use it in GitHub Desktop.
Save AnjaneyuluBatta505/aa1d3e87c23b3ee327c37ff56b89b780 to your computer and use it in GitHub Desktop.
deep attribute lookup
def mgetattr(obj, lookup):
# deep attribute lookup
for attr in lookup.split('.'):
obj = getattr(obj, attr)
return obj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment