bini

A lib to parse and modify bini-files
 
------------------------------------
The parsed bini is a tuple:
 
bini = (int,[section])
section = (str,[entry])
entry = (str,[value])
value = int | float | string
------------------------------------
 
Example:
 
def negateEmpathy(b):
    version, sections = b
    for section in sections:
        secname, entries = section
        for entry in entries:
            entryname, values = entry
            if entryname == "empathy_rate":
                values[1] *= -1
    return b
 
if __name__ == "__main__":
    b = readBini("empathy.ini")
    writeIni("empathy.ini.txt", b)
    writeBini("empathy2.ini", negateEmpathy(b))
    print(biniToStr(b))

 
Functions
       
biniToStr(bini)
creates a string from the bini-representation
readBini(path)
read a bini-file and parse it into its abstract representation
writeBini(path, bini)
create a bini-file using its abstract representation
writeIni(path, bini)
create an ini-file using the bini's abstract representation