Untitled

 avatar
unknown
plain_text
10 months ago
507 B
5
Indexable
    with open(dotenv_path) as f:
        for line in f:
            # Strip whitespace and ignore comments
            line = line.strip()
            if not line or line.startswith('#'):
                continue
            
            # Split the key and value
            key, value = line.split('=', 1)
            key = key.strip()
            value = value.strip().strip('"').strip("'")  # Remove extra spaces and quotes

            # Set the environment variable
            os.environ[key] = value
Editor is loading...
Leave a Comment