Python from Keyword

❮ Python Keywords


Example

Import only the time section from the datetime module, and print the time as if it was 15:00:

from datetime import time

x = time(hour=15)

print(x)
Try it Yourself »

Definition and Usage

The from keyword is used to import only a specified section from a module.


Related Pages

The import keyword.

The as keyword.

Read more about modules in our Python Modules Tutorial.


❮ Python Keywords

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