Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python getAttr

class Student:
  marks = 88
  name = 'Sheeran'

person = Student()

name = getattr(person, 'name')
print(name)

marks = getattr(person, 'marks')
print(marks)

# Output: Sheeran
#         88
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #python #getAttr
ADD COMMENT
Topic
Name
6+3 =