DEV
2022-06-05 02:11:06 +02:00
2022-12-16 22:34:06 +01:00
2022-05-24 20:17:36 +00:00
2022-05-24 22:29:23 +02:00
2022-05-24 22:29:23 +02:00
2022-05-24 20:17:36 +00:00
2022-09-05 00:12:38 +02:00
DEV
2022-06-06 17:43:08 +02:00
2022-12-16 21:59:19 +01:00

ChaCha-INI

*** Yet another python INI parser / generator ! ***

This one aim to be simple and initially targets Unreal Tournament Series configuration files, but aim to work on most ini implementation.

key features

  • handling multiple Sections instance with same name
  • handling multiple Keys instance with same name in the same section, using filters
  • generate output INI with or without spaces around =
  • strict mode: detect missformed INI files
  • blank lines and comments are kept
  • Wipe comments

Limitations

  • Comments and blank lines can only be add in order
  • Multiple sections with same name are supported for existing files but can not be added through API

Installation

From main repository:

python3 -m pip install git+https://chacha.ddns.net/gitea/chacha/ChaChaSimpleINI

Usage

Input INI:

;MyIni File
[section1]
key1=12

code:

from ChaChaSimpleINI import * 

MyINI = ChaChaSimpleINI("~/myINI.ini")

key1 = MyINI.getKeyValue("section1","key1")     # open: [section1], get: key1=<???> value
print(key1)                                     # will output 12

MyINI.setAddKeyValue("section1","key2",42)      # open: [section1], set: key2=<???> value
MyINI.writeFile(False)                          # write the file without beautify option

MyINI.setFilePath("~/myINI_nocomments.ini")     # set a new output file target    
MyINI.writeFile(False)                          # write the file without beautify option and without comments

Output INI:

/> cat ~/myINI.ini

;MyIni File
[section1]
key1=12
key2=42

/> cat ~/myINI_nocomments.ini

[section1]
key1=12
key2=42

To see more advanced examples, refer to the included unittest code.

Copyright

ChaChaSimpleINI is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Unported License. You should have received a copy of the license along with this work. If not, see https://creativecommons.org/licenses/by-nc-sa/4.0/.

Description
Yet another INI parser / generator. special feature: ability to handle multiple key / section instance.
Readme 65 KiB
V0.3.4 Latest
2022-11-11 21:50:10 +01:00
Languages
Python 100%