Spaces:
Running
Running
File size: 554 Bytes
91f7972 58f6308 91f7972 58f6308 91f7972 58f6308 91f7972 58f6308 91f7972 58f6308 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | def read_ini_config(content):
"""Read a simple INI configuration."""
config = {}
current_section = None
for line in content.split("\n"):
line = line.strip()
if not line or line.startswith("#"):
continue
if line.startswith("[") and line.endswith("]"):
current_section = line[1:-1]
config[current_section] = {}
elif "=" in line and current_section:
key, val = line.split("=", 1)
config[current_section][key.strip()] = val.strip()
return config
|