beginners syntax question
Chris Liechti
cliechti at gmx.net
Sat Apr 6 15:43:40 EST 2002
tony clarke <a.clarke11 at ntlworld.com> wrote in
news:3CAF4E4B.ECE28871 at ntlworld.com:
> Hi
>
> Try listing the objects l=["object1','object2'..]
> then
> for i in l:
> i.update()
almost, leave away the quotes:
l=[object1, object2]
>> I'm trying to call the update() method of several objects ie:
>>
>> object1.update()
>> object2.update()
>> etc
>>
>> I'd really like to do
>>
>> for x in range(7):
>> "object"+str(x).update
>>
>> but can't figure outthe syntax, is this possible?
yes it is, but there are better ways.
why are you not storing the objects in a list
instead of naming them with numbers?
calling methods on objects in a list is shown above.
chris
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list