Python Modules

Python Modules

Now, we are going to explore the modules in python. Basically, the modules are nothing but python files, which we can import into other python programs. In other words, we can say that the modules are the python files that contain some class, variables, and related functions, which we can use in other programs. There can be some built-in modules, and we can also create our own modules.

First of all, Let’s consider the built-in modules, which simply means that there are some modules already written so that we can just import and use them in our programs.

So, how we can find the built-in modules from python? Well, it is very easy, and we can get a list of modules in a fraction of the time. Note that there are many modules, and it also depends on the distribution. To get the list of all the available modules, we just need to follow these instructions.

Python Modules

  • Open a command prompt. (Terminal)
  • Type python in the command prompt.

This will start the python interpreter in the command prompt.

  • Type help
  • then type help()
  • type modules

Just by doing the above steps, we can simply get the list of all the available modules. There are many many modules, but let’s mention a few names over here –

Python Modules List

pillowasynciommaptabnanny
PyInstallerasynciommapfiletarfile
turtlemathrandomdatetime
ostypingunittesturllib
collectionspicklecopywebbrowser
threadingpipeswin10toastcsv
win32clipboardpoplibpprintdistutils
emailenumftplibre
futuresqlite3secretshtml
httpshutilsignalsocket
abcsmtplibtkinterwinsound
itertoolsjsonsslstat
antigravitysysxmlkeyword
timevenvmultiprocessingipaddress

There are many other libraries, which can be imported and used in our programs, for different purposes, for example, numpy, pandas, scikit-learn, sciPy, Matplotlib, seaborn, Requests, BeautifulSoup, PyGame, and many many others, which you can explore.

These modules that are mentioned above are intended for specific use and whenever they are needed, they can be imported into the program and used. So, these modules contain some functions and classes, and variables that you might want to use in your program. The good news is that you don’t have to write everything from scratch (you can choose this option too though), but python has done many things already for you.

For example, if you want to do some mathematical operations like trigonometric functions, or you want to work on a GUI(graphical user interface) application, you can have some modules which have some functions that can help you a lot with your tasks.