Python from Keyword
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.