Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
Python
python class get attribute by name
Sam
Programming language:
Python
2021-04-05 08:49:44
0
Q:
python class get attribute by name
Anglophile
Code:
Python
2021-05-31 20:11:24
>>> class c: pass o = c() >>> setattr(o, "foo", "bar") >>> o.foo 'bar' >>> getattr(o, "foo") 'bar'
0
Tags
name
python
get
class
attribute
Related
how to get name of class in class python
python get object attribute by string
python get names of all classes
python3 check if object has attribute
how to get all values from class in python
python get type class name
python object with attributes
python class name
python get attributes of object
scrapy get inside attribute value
New to Communities?
Join the community