Python as Keyword

❮ Python Keywords


Example

Refer to the calendar module as c:

import calendar as c

print(c.month_name[1])
Try it Yourself »

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

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