Skip to main content

a lightweight ini parser

Project description

a lightweight ini parser

how to install

pip install ini.py

converts an ini file to a python dictionary

example ini file

; main section
[section]
key = value
key2 = "value2"
key3 = 'value3'

reading it using ini.py

import ini

text = open('config.ini', 'r').read()

config = ini.parse(text)

section = config['section']

print(section['key'], section['key2'], section['key3'])

output

value value2 value3

converting python dict to ini

import ini

config = ini.convert({"section": {"key": "value"}, "section2": {"key2": "value2"}})


print(config)

output

[section]
key = value

[section2]
key2 = value2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ini.py-0.0.5.tar.gz (2.0 kB view hashes)

Uploaded Source

Built Distribution

ini.py-0.0.5-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page