Glossary
Import
Import libraries in Python
In Python,youβll often want to bring in other pieces of code. This could be code that you wrote, or someone else wrote. The most basic case is bringing in other libraries. In order to do this, youβll need to import
.
Python Import
Once you import a library, its name will be a part of your python namespace. These are the keywords that python will recognize and execute.
However, if your library name is long, like matplotlib, then you may want to have a shorthand way to reference the code. This is where the keyword as
comes in.
If you follow your import
statement with as
youβll have a new, shorter name for your library.
Letβs look at a quick code sample.