0
Is it possible to append to a in this case?And how
class X : def __init__(self): self.a = [] self.b = [] self.c = [] X.a.append(1) wont work
2 ответов
+ 5
Make <a>, <b> and <c> become class member, define them in global space
class X:
a = []
b = []
c = []
for i in range( 1, 43 ):
X.a.append( i )
print(X.a)
(Edit)
You already have the answer in your earlier post
https://www.sololearn.com/Discuss/3017234/?ref=app
+ 2
In this case you have to instantiate an X object first:
x = X()
x.a.append()