Configuration file guides

Compact a Config File With a Multiline Message

·

If a message spans several indented INI lines, deleting every blank line can change what the reader sees. Identify the selected parser’s multiline rules before compacting the file.

INI Compressor

Reduce the 198-byte notes file to 100 bytes

Load the example and run Compress INI. ConfigParser-style raw INI recognizes the second and final indented lines as part of message. Compression removes the blank line before the section and two full-line comments. The original 198-byte sample becomes 100 bytes.

The blank line between second line and final line stays because it belongs to the multiline value. The inline text following the semicolon in final line also stays. This dialect treats only full-line comment markers as comments.

Python ConfigParser, supported structure and parser customization

Keep the release notes beside the settings

Select Keep full-line comments and compress again. Both full-line comments return. Separator spacing still compacts, and the blank line inside message stays.

The code value remains 0012 and the template value stays %(code)s. The tool leaves interpolation unevaluated. If your target expands it, verify the result with the target’s own interpolation settings.

Python ConfigParser, supported structure and parser customizationPython ConfigParser, interpolation behavior

Compare the source and compact values in a raw reader

Open the downloaded compressed.ini as UTF-8. Check both message segments and the empty line between them. A Python ConfigParser configured with interpolation=None can read both sample files for a raw value comparison.

Select the same settings in your own reader, especially how blank lines and comment prefixes are handled. For a mixed-ending file, open the local file directly and compare the bytes of retained continuation lines with your original.

Python ConfigParser, supported structure and parser customizationPython ConfigParser, interpolation behavior

Common questions

Can a file still have spaces after compression?

Yes. It preserves indentation, whitespace inside values and the full text of retained continuation lines.

Is the compact export a compressed archive?

It is still plain UTF-8 INI. Compression here reduces source layout and optional comments.

Sources

Put it into practice.

Related guides