append element of list using python -
this question has answer here:
i want append element single object in list, object appends elements of list.
class a: list_of_b=[] class b: name = "" list_a = [a() in range(3)] list_b = [b() j in range(7)] list_b[0] = "1" list_b[1] = "2" list_b[2] = "3" list_a[2].list_of_b.append(list_b[1])
my problem element list_b[1] appends element in list_a not element lista_a[2].
list_of_b
class variable, change instance variable
class a: def __init__(self): self.list_of_b = []
Comments
Post a Comment