Use configParser module in Python.
Config files with extension .ini are very useful for different purposes, like:
- storing app configuration
- hiding sensitive data
Today we will learn the basics of creating those very config files, using them with configParser module which comes as a built-in package in Python. So, let’s dive in!

At first, we need to create a config.ini file. That will be something like this:
The data can be divided into sections. Here are 2 sections([settings] & [aws]) in this code snippet. The values assigned in the variable will be stored as strings. So now, it’s time to access those values. For that, we go to a (say) config_scripts.py file and write something like this:
We can also write into config.ini file from the config_scripts.py file. How?
Running this code will show one more section(i.e. 3 instead of 2) which was added dynamically in the config.ini file. So it will give an output like:
Sections: ["settings", "aws", "more"]
So these are some chunks I know. Please share with me, if you know something more interesting or necessary. Please let me know if anything is not working or discuss my mistakes without any hesitations. Tada!
References: