For example, I have a class.

class Smth(): __init__(self, что я должен написать здесь???): И здесь, чтобы инициализировать все переменные 

And it is here that I do not know what to do. If I don’t know the exact number of elements to be entered, how do I initialize them ???

 a = Smth('a','b','c') 

1 answer 1

?

 class Smth: def __init__(self, *args, **kwargs): self.l = list(args) for key, value in kwargs.items(): setattr(self,key, value) S(1, 2, a='a', b='b') 
  • and if i need a list? - Bernard