DEV Community

Discussion on: Using .env Files for Environment Variables in Python Applications

Collapse
 
thierrynjike profile image
Thierry Njike • Edited

you can write inside using this

with open("$path/to/.env", 'a+') as newenv:
    newenv.write("\n$varname=$varvalue")
load_dotenv()           #load vars again to consider the new added one

Enter fullscreen mode Exit fullscreen mode