problem with eval while using PythonCard
7stud
bbxx789_05ss at yahoo.com
Fri May 25 18:05:03 EDT 2007
Here's a complete example:
###################
#create object 's':
class S(object):pass
class X(object):pass
class Y(object):pass
s = S()
s.components = X()
s.components.d1 = Y()
s.components.d2 = Y()
s.components.d3 = Y()
######################
######################
set some initial values:
for i in range(1, 4):
obj = getattr(s.components, "d" + str(i))
obj.text = "hello world"
#####################
#####################
#change the values:
for i in range(1, 4):
getattr(s.components, "d" + str(i)).text = "goodybe"
#####################
#####################
#print out the new values:
for i in range(1, 4):
print getattr(s.components, "d" + str(i)).text
#####################
More information about the Python-list
mailing list