Python import Keyword

❮ Python Keywords


Example

Import the datetime module and display the current date and time:

import datetime

x = datetime.datetime.now()
print(x)
Try it Yourself »

Definition and Usage

The import keyword is used to import modules.


Related Pages

The from keyword.

The as keyword.

Read more about modules in our Python Modules Tutorial.


❮ Python Keywords

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.