Importing External Modules
So far, you’ve used Python’s built-in tools like math
, random
, and datetime
.
But Python also has a massive ecosystem of external modules created by the community.
These modules:
- Add new features like web scraping, plotting, data analysis, and machine learning
- Are shared on the Python Package Index (PyPI)
- Can be installed with a tool called
pip
You’ll most often use them when you need functionality not included in the standard library.
For example:
- Need to send an HTTP request? Use the
requests
module. - Want to manipulate Excel files? Try
openpyxl
orpandas
. - Plotting charts? Use
matplotlib
.
We don’t write these modules from scratch — we import and reuse them, which saves time and reduces bugs.
In the next slides, we’ll walk through:
- How to install a module using
pip
- How to import it in your code
- What to watch out for when managing versions
What’s Next?
In the next lesson of this chapter, you’ll test your understanding of functions, scope, error handling, files, and modules with a recap quiz!
Quiz
0 / 1
What tool do you use to install external Python modules?
Python external modules can be installed using .
npm
pip
brew
apt
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help