As in the question, I have a string variable that may correspond to many values.
I want to assign a value to the corresponding attribute of the class based on the value. What should I do?
My code is as follows:
This code c1.__dict__[var1] = 'string' i want to achieve c1.value1='string'。
How should I write the code?
class My_Class():
    def __init__(self):
        self.value1 = ''
        self.value2 = ''
        return
def main():
    var1 = 'value1'
    c1 = My_Class()
    c1.__dict__[var1] = 'string'
if __name__ == '__main__':
    main()
