How to use 'python see attributes of object' in Python

Every line of 'python see attributes of object' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
8def give_attributes_of_object(obj):
9 result = {}
10 types_list = [str, int, float]
11 for name in dir(obj):
12 if type(obj.__getattribute__(name)) in types_list:
13 result[name] = obj.__getattribute__(name)
14 return result

Use secure code every time

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

Related snippets