Skip to main content
edited title
Link
Pierre de LESPINAY
  • 46.5k
  • 62
  • 223
  • 318

Python - Access an object attributes likeas in a dictionary

edited title
Source Link
Pierre de LESPINAY
  • 46.5k
  • 62
  • 223
  • 318

Python - Access an object attributes like in a dictionary

>>> my_object.name = 'stuff'
>>> my_str = 'name'
>>> my_object[my_str] # won't work because it's not a dictionary :)

How can I access to the fields of my_object defined on my_str ?

Python - Access an object attributes like a dictionary

>>> my_object.name = 'stuff'
>>> my_str = 'name'

How can I access to the fields of my_object defined on my_str ?

Python - Access an object attributes like in a dictionary

>>> my_object.name = 'stuff'
>>> my_str = 'name'
>>> my_object[my_str] # won't work because it's not a dictionary :)

How can I access to the fields of my_object defined on my_str ?

Source Link
Pierre de LESPINAY
  • 46.5k
  • 62
  • 223
  • 318

Python - Access an object attributes like a dictionary

>>> my_object.name = 'stuff'
>>> my_str = 'name'

How can I access to the fields of my_object defined on my_str ?