Using "from module import something"

Let's talk about how we can import something from the module and how it works.

We'll cover the following...

How can we import a module in Python?

There are many times when we just want to import part of a module or library.

Let’s see how Python accomplishes this:

Press + to interact
from functools import lru_cache

What the code above does is allow us to call lru_cache directly. If we had imported just functools the normal way, then we would have to call lru_cache using something like ...

Access this course and 1400+ top-rated courses and projects.