Sort INI configuration files in Python

--

INI files are a popular choice for creating configurations for programs. Each file contains various sections and each section contains the settings.

For example

[DEFAULT]
ServerAliveInterval = 45
Compression = yes
CompressionLevel = 9
ForwardX11 = yes
[bitbucket.org]
User = hg
[topsecret.server.com]
Port = 50022
ForwardX11 = no

Sometimes INI configuration files become really large and there is a need to sort them so that you can better compare different versions. The following script can sort and save the sorted version of an existing configuration file in Python 3 version.

--

--

Angelos Alexopoulos
Angelos Alexopoulos

No responses yet