python module init.py code example
Example 1: init in python
class Employee():
no_of_leaves = 8
def __init__(self, aname, asalary, arole):
self.name = aname
self.salary = asalary
self.role = arole
def printdetail(self):
return f"Name is {self.name}. His salary is {self.salary}." \
f"and his role is {self.role}"
Example 2: import __init__.py
# use this for python script(s) in same folder where __init__.py is in
# it'll save typing up common imports for multiple python scripts
from . import *
# if want to be specific
from . import hello_world