durant
durant

Reputation: 31

Library Constants - How to Use

Can someone help me on how to use the constants library? I am doing a sports data project and want to create a CSV file based on season dates. I found this project on GitHub where they have used

from constants import SEASON_DATES

The following also gives an error

SEASON_DATES = constants.Constants()

but this gave me errors; so instead, I did the following:

import constants
SEASON_DATES = constants.Constants

but I am getting an error later where I invoke:

for season in SEASON_DATES.keys()

Error: Type object'constants' has no attribute keys

Upvotes: 0

Views: 79

Answers (1)

gspr
gspr

Reputation: 11227

I assume you mean the constants module from the constants package. The example shown on that package's webpage clearly shows that you should call the Constants constructor, i.e. SEASON_DATES = constants.Constants() (though probably with some arguments).

Upvotes: 1

Related Questions