THE WORLD'S LARGEST WEB DEVELOPER SITE

Python as Keyword

❮ Python Keywords


Example

Refer to the calendar module as c:

import calendar as c

print(c.month_name[1])
Run example »

Definition and Usage

The as keyword is used to create an alias.

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


Related Pages

The import keyword.

The from keyword.

Read more about modules in our Python Modules Tutorial.


❮ Python Keywords