0

here is my beginner problem: I want to create a class with numerous attributes using a dictionary. Instead of using def init(self, att1, att2...) I'm trying to do:

class Promo:
    def __init__(self, **kwargs):
        for k in kwargs:
            self.k = kwargs[k]

passing a dictionary {att1:'xxxx', att2:'yyyy' , .....} as argument. Since I have a dozen of named arguments in each dictionary, how can I use **kwargs in my code? Thanks for you advice!! de716

deceze
  • 510,633
  • 85
  • 743
  • 889
De716
  • 1
  • 1

0 Answers0