How to create a series of variable/object names by loops

How to create a series of variable/object names by loops

Anonymous
Not applicable
425 Views
0 Replies
Message 1 of 1

How to create a series of variable/object names by loops

Anonymous
Not applicable

for example, I would like to realize the same as below in maxscript, so I can automatically create string1, string2, string3 and asign them values at the same time by a loop.

d={}
for x in range(1,10):
d["string{0}".format(x)]="Hello"
In [7]: d["string5"]
Out[7]: 'Hello'
In [8]: d
Out[8]: 
{'string1': 'Hello',
'string2': 'Hello',
'string3': 'Hello',
'string4': 'Hello',
'string5': 'Hello',
'string6': 'Hello',
'string7': 'Hello',
'string8': 'Hello',
'string9': 'Hello'}
0 Likes
426 Views
0 Replies
Replies (0)