In this post we’ll be learning about What is __init__ in python and what does it mean. In Python file names are quite different from other programming languages, often confuse developers and hard to understand.
In this post we’ll be learning about What is init in python and what does it mean. In Python file names are quite different from other programming languages, often confuse developers and hard to understand.
Don’t worry we have all the answere for your question regarding python’s init.py file. So without wasting less time lets get started.
The directory in which init.py file is located tells Python to marked that directory as Package. It may be empty or may contain some python code that could be used by package.
A Package is a collection of modules under a single directory. Each module may contain variables, functions and classes. A Package can also have a Sub-Package. We can create Sub-Package simply by creating init.py file inside package directory.
Every time the module inside package is called init.py file is excuted internally.
Below is a example of directory structure.
project | | - package_a ## This is a main package | | | | | - __init__.py | - modules.py | | | - sub_package_1 ## This is a sub package | | | | | | | | - __init__.py | | - sub_demo1.py | | - student.py ## this file is outside package
The most Python programs will consist of three steps — getting input into the program, processing the input in some way, and outputting the results of the processing. I’m going to focus on one part of that step — getting input into a program — by prompting the user to enter some data and then reading the data into the program. This is a mostly straightforward process except for some data conversions that have to occur when you are inputting numbers.
In this tutorial, you’re going to learn a variety of Python tricks that you can use to write your Python code in a more readable and efficient way like a pro.
This LIVE session on 'Python Libraries' will help you understand the topmost trending Python libraries toy must learn.
Today you're going to learn how to use Python programming in a way that can ultimately save a lot of space on your drive by removing all the duplicates. We gonna use Python OS remove( ) method to remove the duplicates on our drive. Well, that's simple you just call remove ( ) with a parameter of the name of the file you wanna remove done.
Basic programming concept in any language will help but not require to attend this tutorial