Python uses dictionary arguments to create constructors

class settings:
    def __init__(self,leds):
        for i in leds:
            -sharpprint(i,leds[i])
            self.i = leds[i]

leds={"redb":4,"gerd":27,"yelb":29}
s=settings(leds)

I want to pass the leds dictionary into this constructor and generate it recursively, but this is an error. Is there any easy way to construct a function directly based on item and corresponding values for this type of dictionary?

May.24,2021

The special methods of attribute management in

python are _ _ getattr__ , _ _ getattribute__ , _ _ setattr__ , _ _ delattr__ , _ _ dir__ , and so on. _ _ setattr__ literally knows that it can be used to bind properties to objects.

class settings:
    def __init__(self,leds):
        for i in leds:
            self.__dict__[i] = leds[i]

leds={'redb':4,'gerd':27,'yelb':29}
s=settings(leds)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b88d-2b604.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b88d-2b604.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?