# Python : Env Packages ## python-dotenv By default: Looks for `.env` file in same directory as script and doesn’t overwrite existing env vars. #### File Format - keys can be unquoted or single-quoted - values can be unquoted, single-quoted, or double-quoted - whitespace around keys, values, and = is ignored - values can be followed by a comment - quoted strings support multiline - double-quoted strings support escape sequences - supports variable interpolation using `${}` ``` MEN=12 TITLE="${MEN} Angry Men" ``` - values and = not required ``` FOO ignored by load_dotenv(), set to None by dotenv_values() FOO = set to empty string by both ``` #### API ```python from dotenv import dotenv_values, load_dotenv load_dotenv( dotenv_path = None stream = None verbose = False override = False interpolate = True encoding = "utf-8" ) values = dotenv_values( ... ) # same options as load_dotenv() except "override"` ```