narayana reddy

narayana reddy


What are the Modules in Python?

A file with the python code is a module. The code may take the form of specified variables, functions, or classes. The filename becomes a name for the module.
For instance, A “filename” will be the name of the module within this language. With module features, instead of writing everything within one file, you can split the code into multiple files.
What is the module for importing Python?
A file is called a python module. You have to import it using the import keyword to use the module. By importing the module, the function or variables present inside the file may be used in another file. This feature is available in other languages, such as Typescript, Python, JavaScript, Ruby, etc.
How to create a module in Python and import it?
We’re going to build a module now and import it into a separate file.
The flow for generating and importing the module is as shown in the screenshot:
To build a module in Python Online Training, follow the steps given.
The layout of the folder used in testing the code is as follows:
Modtest/ modtest/ modtest/
Step 1)
Build a file and call it
Phase 2)
Build a function called view message within testpy ()
Display message() def:
Phase 3)
Build another file now.
Step 4)
Import the file from inside, as shown below:
Import Test ()
You don’t have to mention when importing, but just the name of the file.
You need to use the module name.function name. Then you can call the display message() function from inside
Test.display message, for example ().
Import Test Test
Printing(test.display message())
Phase 6)
You will get the following output when you execute
Importing a Python class
We’ve seen a simple module with a purpose before. Here a class is generated and the class in another file is referenced.
The following is the folder structure for checking the code.
About myproj/,
Build a file named with the code below:
Def init (self, brand name, model, year-manu):
Self.brand name = name of the brand
Model: self.model = model
Self.manu year = manu year
Details(self) def car:
Print(‘Car brand is’, name of self.brand)

Print(‘The year of car manufacture is’, self.manu-year)
Brand(self): def get Car brand(self):
Print(‘Car brand is’, name of self.brand)
Def get-Car-model(self): def def

There are brand name, model, and manual year attributes in the format. Car details(), get Car brand(), get Car model() are the functions specified within the class ().
Let us use the file now as a module in another file named
Importing a Car
Car-det = CarCarCar (“BMW”,“Z5”, 2020)
Printing(car det.brand name)
Printing(car details())
Print(car det.get Car brand())
Print(car det.get Car model())
So using the Car module, we can access all the variables and functions from
Using the import module from
Instead of importing the entire code, you can import only a small portion of the module, i.e. only the necessary functions and variable names from the module.
If you just want to import unique items, you can use the “from” keyword to import what you want.
The syntax, therefore is
Importing your feature name from the module, variables,… etc., etc.
The layout of the folder used in testing the code is as follows:
Modtest/ modtest/ modtest/
There are 2 functions in, as shown:
Defdisplay message():
Display message1() def:
"All about Python!"All about Python!
Now you want a feature called display message(). You can directly access the function or variable you are importing, as shown below:
Name of the file:
Display message from test import view message
The print(display message())
Now, if you use the display message1() feature, it will trigger an error that does not define the function as shown below:
Display message from test import view message
Print(message display1()))
Importing from the module all
Import allows you to import a complete module using import, followed by the name of the module, i.e. the filename or library you want to use.
Import module
Or by making use of
Import from module *
The layout of the folder used in testing the code is as follows:
Modtest/ modtest/ modtest/
The code specifics inside are as follows.
Defdisplay message():
Display message1() def:
"All about Python!"All about Python!
Use the module for importing
Using only the import module name, the module name must be prefixed to refer to the variables and functions within the module.
Import Test
Printing(test.display message())
Print(test.display message1())) in print
Printing( name)
Printing( address)
The module name test is used within the module test to refer to the function and the variables.
Using importation
Let us see an example that uses import*. The functions and variables are directly accessible using import*, as seen in the example below:
Import from test*
The print(display message())
Print(message display1()))
Print(my name) Print
Print(my address) Print
Operation dir()
The dir() is a built-in-function in python. The dir() function returns all properties and methods, including the built-in properties of the given entity.
So when dir() is used on the module, it gives you the variables, the functions inside the module that are present.
On a module, here is a working example of dir(). Let’s import the car and assign it to dir() to see the performance. We have a class called
The layout of the folder to evaluate the code will be as follows.
Test prop/test prop/test prop/,
Def init (self, brand name, model, year-manu):
Self.brand name = name of the brand
Model: self.model = model
Self.manu year = manu year
Details(self) def car:
Print(‘Car brand is’, name of self.brand)
Print(‘The year of car manufacture is’, self.manu-year)
Brand(self): def get Car brand(self):
Print(‘Car brand is’, name of self.brand)
Def get-Car-model(self): def def
Importing a Car
Class Contents = dir Dir Contents (Car)
The output gives us the class name and all the functions specified in the program.
You can also try using dir() on the built-in Python module that is available. As shown in the example below, let us try the same on the JSON module. All properties and methods available in the JSON module will be shown.
Xml imports
Information of json = dir (json)
Printing(json details)
The Packages
A package is a directory containing all the modules that are specified within it. Your directory should have an init.pyfile to allow the Python interpreter to treat it as a package. The directory as a package is generated by Here is the kit layout that we are going to focus on.
My package is the name of your package. Create a directory called package/ in order to start working with the package. Develop three additional,, and files and describe the features as shown in the screenshot. The descriptions of,, and are given here. module
Func1():: def mod1 func1():
Print a Print (“Welcome to Module1 function1”)
Func2():: def mod1 func2():
Print a Print (“Welcome to Module1 function2”)
Func3():: def mod1 func3():
Print a Print (“Welcome to Module1 function3”) module
Func1():: def mod2 func1():
Print a Print (“Welcome to Module2 function1”)
Func2():: def mod2 func2():
Print a Print (“Welcome to Module2 function2”)
Func3():: def mod2 func3():
Print a Print (“Welcome to Module2 function3”) module
Func1():: def mod3 func1():
Print a Print (“Welcome to Module3 function1”)
Func2():: def mod3 func2():
Print a Print (“Welcome to Module3 function2”)
Def mod3 func3()::: def
Print a Print (“Welcome to Module3 function3”)
Packages that are ready for use.
Now, as shown below, call the package inside any of your In this case, mypackage.module1 is imported and the alias name is provided as mod1.
Similarly, you can use and from my kit for other modules.
You may get a brief idea about Python modules. You can learn more about Python modules and other topics through Python online training.

#learnpython #pythoncourse #pythononlinetraining #pythoncertification

What is GEEK

Buddha Community

Ray  Patel

Ray Patel


Top 20 Most Useful Python Modules or Packages

 March 25, 2021  Deepak@321  0 Comments

Welcome to my blog, In this article, we will learn the top 20 most useful python modules or packages and these modules every Python developer should know.

Hello everybody and welcome back so in this article I’m going to be sharing with you 20 Python modules you need to know. Now I’ve split these python modules into four different categories to make little bit easier for us and the categories are:

  1. Web Development
  2. Data Science
  3. Machine Learning
  4. AI and graphical user interfaces.

Near the end of the article, I also share my personal favorite Python module so make sure you stay tuned to see what that is also make sure to share with me in the comments down below your favorite Python module.

#python #packages or libraries #python 20 modules #python 20 most usefull modules #python intersting modules #top 20 python libraries #top 20 python modules #top 20 python packages

Shardul Bhatt

Shardul Bhatt


Why use Python for Software Development

No programming language is pretty much as diverse as Python. It enables building cutting edge applications effortlessly. Developers are as yet investigating the full capability of end-to-end Python development services in various areas. 

By areas, we mean FinTech, HealthTech, InsureTech, Cybersecurity, and that's just the beginning. These are New Economy areas, and Python has the ability to serve every one of them. The vast majority of them require massive computational abilities. Python's code is dynamic and powerful - equipped for taking care of the heavy traffic and substantial algorithmic capacities. 

Programming advancement is multidimensional today. Endeavor programming requires an intelligent application with AI and ML capacities. Shopper based applications require information examination to convey a superior client experience. Netflix, Trello, and Amazon are genuine instances of such applications. Python assists with building them effortlessly. 

5 Reasons to Utilize Python for Programming Web Apps 

Python can do such numerous things that developers can't discover enough reasons to admire it. Python application development isn't restricted to web and enterprise applications. It is exceptionally adaptable and superb for a wide range of uses.

Robust frameworks 

Python is known for its tools and frameworks. There's a structure for everything. Django is helpful for building web applications, venture applications, logical applications, and mathematical processing. Flask is another web improvement framework with no conditions. 

Web2Py, CherryPy, and Falcon offer incredible capabilities to customize Python development services. A large portion of them are open-source frameworks that allow quick turn of events. 

Simple to read and compose 

Python has an improved sentence structure - one that is like the English language. New engineers for Python can undoubtedly understand where they stand in the development process. The simplicity of composing allows quick application building. 

The motivation behind building Python, as said by its maker Guido Van Rossum, was to empower even beginner engineers to comprehend the programming language. The simple coding likewise permits developers to roll out speedy improvements without getting confused by pointless subtleties. 

Utilized by the best 

Alright - Python isn't simply one more programming language. It should have something, which is the reason the business giants use it. Furthermore, that too for different purposes. Developers at Google use Python to assemble framework organization systems, parallel information pusher, code audit, testing and QA, and substantially more. Netflix utilizes Python web development services for its recommendation algorithm and media player. 

Massive community support 

Python has a steadily developing community that offers enormous help. From amateurs to specialists, there's everybody. There are a lot of instructional exercises, documentation, and guides accessible for Python web development solutions. 

Today, numerous universities start with Python, adding to the quantity of individuals in the community. Frequently, Python designers team up on various tasks and help each other with algorithmic, utilitarian, and application critical thinking. 

Progressive applications 

Python is the greatest supporter of data science, Machine Learning, and Artificial Intelligence at any enterprise software development company. Its utilization cases in cutting edge applications are the most compelling motivation for its prosperity. Python is the second most well known tool after R for data analytics.

The simplicity of getting sorted out, overseeing, and visualizing information through unique libraries makes it ideal for data based applications. TensorFlow for neural networks and OpenCV for computer vision are two of Python's most well known use cases for Machine learning applications.


Thinking about the advances in programming and innovation, Python is a YES for an assorted scope of utilizations. Game development, web application development services, GUI advancement, ML and AI improvement, Enterprise and customer applications - every one of them uses Python to its full potential. 

The disadvantages of Python web improvement arrangements are regularly disregarded by developers and organizations because of the advantages it gives. They focus on quality over speed and performance over blunders. That is the reason it's a good idea to utilize Python for building the applications of the future.

#python development services #python development company #python app development #python development #python in web development #python software development

Ray  Patel

Ray Patel


Difference Between Python Module and Python Package?

Difference between python module and python package?

What’s the difference between a Python module and a Python package?

Module:  It is a simple Python file that contains collections of functions and global variables and has a “.py”  extension file. It’s an executable file and we have something called a “Package” in Python to organize all these modules.

Package:  It is a simple directory which has collections of modules, i.e., a package is a directory of Python modules containing an additional  file. It is the  which maintains the distinction between a package and a directory that contains a bunch of Python scripts. A Package simply is a namespace. A package can also contain sub-packages.

When we import a module or a package, Python creates a corresponding object which is always of type module . This means that the dissimilarity is just at the file system level between module and package.

#technology #python #what's the difference between a python module and a python package? #python package #python module

Art  Lind

Art Lind


Python Tricks Every Developer Should Know

Python is awesome, it’s one of the easiest languages with simple and intuitive syntax but wait, have you ever thought that there might ways to write your python code simpler?

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.

Let’s get started

Swapping value in Python

Instead of creating a temporary variable to hold the value of the one while swapping, you can do this instead

>>> FirstName = "kalebu"
>>> LastName = "Jordan"
>>> FirstName, LastName = LastName, FirstName 
>>> print(FirstName, LastName)
('Jordan', 'kalebu')

#python #python-programming #python3 #python-tutorials #learn-python #python-tips #python-skills #python-development

Art  Lind

Art Lind


How to Remove all Duplicate Files on your Drive via Python

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.


In many situations you may find yourself having duplicates files on your disk and but when it comes to tracking and checking them manually it can tedious.

Heres a solution

Instead of tracking throughout your disk to see if there is a duplicate, you can automate the process using coding, by writing a program to recursively track through the disk and remove all the found duplicates and that’s what this article is about.

But How do we do it?

If we were to read the whole file and then compare it to the rest of the files recursively through the given directory it will take a very long time, then how do we do it?

The answer is hashing, with hashing can generate a given string of letters and numbers which act as the identity of a given file and if we find any other file with the same identity we gonna delete it.

There’s a variety of hashing algorithms out there such as

  • md5
  • sha1
  • sha224, sha256, sha384 and sha512

#python-programming #python-tutorials #learn-python #python-project #python3 #python #python-skills #python-tips