What is __init__ in python?
__init__ is used to initialize object in a class. It is a reserved method in python classes.
It indicates what data must be supplied when an instance of class is created and how that data is stored internally.
It is a constructor in python.
syntax:-
class name_of_class(): def __init__(self,arg1, argu2): self.arg1=arg1 self.arg2=arg2
This is all about __init__ in python.
Subscribe
Login
Please login to comment
0 Discussion