Advertisements
Advertisements
प्रश्न
Give the statement to assign a value "Hello" to the attribute str of class Test and object T1.
अति संक्षिप्त उत्तर
Advertisements
उत्तर
setattr(T1, "str", "Hello")
To create/set str as a class attribute shared by all objects, use:
setattr(Test, "str", "Hello")
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
