Skip to main content

Python library for Java .properties file parsing

Project description

[![Build Status](](

A python library for parsing and handling Java .properties files.

$ pip install jproperties3


$ python test


$ python build


A Properties object is, on the outside, a simple key-value store.

Initialize it as such:

from jproperties import Properties

p = Properties()

# Or with default values:
p2 = Properties({"foo": "bar"})

The usual dictionary interfaces are available:

p2["key"] = "value"
for key in p2.keys():
print(key, p2[key])

Note that keys and values are all expected to be and be treated as strings.

To serialize the object into the .properties format, turn it into a string:

with open("", "w") as f:

To read an existing properties file, create the instance using the `stream`
keyword parameter

with open("", "r") as f:
p = Properties(stream=f)

Note that comments and blank lines are loaded into the Properties object's
nodes when using load(), and will be serialized in str().

If comments and blank lines are unimportant and you want to get rid of them,
you can create a new Properties object from an existing one's keys:

p3 = Properties(p2.keys())

### License

This project is licensed under the MIT license. The full license text is
available in the LICENSE file.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

jproperties3-0.5.2-py2.py3-none-any.whl (5.6 kB view hashes)

Uploaded 3 6

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