Python as Keyword

Example

Reference to the calendar module c:

import calendar as c
print(c.month_name[1])

Run Instance

Definition and Usage

The as Keyword is used to create an alias.

In the example above, when importing the calendar module, we created an alias c, and now we can use c instead of calendar to refer to the calendar module.

related pages

import Keyword

from Keyword

Please visit our Python Module Tutorial Learn more about modules in Chinese.