What does importing a library do?


#1

Question

What does importing a library do?

Answer

When you write programs of any significant size, you will put other people’s code to use. That’s all a library/module is - someone else’s code. Their code’s functionality is made available through these libraries after being imported and makes development lightyears easier by saving time and energy. Libraries save us from having to reinvent the wheel.
In this case, we’re importing the datetime library, which allows us to d all kinds of cool stuff! Here is the full documentation for the library, where you can find what all you can do with the library.
It’s a good idea to Google the documentation for any library you want to use from now on, as that’s a large part of being a developer!


FAQ: Learn Python - Date and Time - The datetime Library