python how to access class variable code example
Example 1: python print class variables
# to print out the variable names
print(vars(YourClass))
# to print out names and values
for var in vars(YourClass):
print(getattr(YourClass, var))
Example 2: how to access variables from a class in python
class Example(object):
itsProblem = "problem"
theExample = Example()
print(theExample.itsProblem)
print (Example.itsProblem)