Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python how to create attribute of class while iterating a list

>>> class c(object):
...     for i in range(10):
...         locals()['A' + str(i)] = i
... 
>>> c.A0
0
>>> c.A7
7
 
PREVIOUS NEXT
Tagged: #python #create #attribute #class #iterating #list
ADD COMMENT
Topic
Name
7+8 =