Skip to main content

An INI parser or config parser

Project description

iniparser2

Build Status

iniparser2 is An INI parser or a Config parser.

this package is the improved version of iniparser with more features.


Quick Start

Installation

to install the package see the following step below

pip install iniparser2 || python -m pip install iniparser2
from source: python setup.py install

Examples

test.ini:

name = Mike Hawk

test.py:

from iniparser2 import INI

x = INI('test.ini')
data = x.read()

print(data)

Output:

{'name': 'Mike Hawk'}

using with keyword

test.ini:

name = Mike Hawk

test.py:

from iniparser2 import INI

with INI('test.ini') as i:
    print(i.read())

Output:

{'name': 'Mike Hawk'}

parse without file

import iniparser2

x = """
name = Mike Hawk
"""
x = iniparser2.parse(x)
print(x)

INI binary format

import iniparser2

ex_data = {
    "slots": 20,
    "name": "no"
}

x = iniparser2.INI_BIN('test.ini')
x.write(ex_data)
data = x.read()

print(data)

eval parsing

import iniparser2

file = '''
robot = True
token = 32102
amogus = -69.0
message = "beep boop sus"
'''

we = iniparser2.parse(file,eval=True)
wte = iniparser2.parse(file)

print(we,'\n',wte)

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

iniparser2-1.10.2.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

iniparser2-1.10.2-py3-none-any.whl (5.1 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