Skip to main content

Python replacement for java.util.Properties.

Project description


This is a fork of “python replacement for java.util.Properties” recipe on ASPN: The project is maintained by Anand B Pillai, .


The code is re-licensed under MIT License. See LICENSE file for more details.

What this is

This module is designed to be a python equivalent to the java.util.Properties <>_ class.

Currently, the basic input/output methods are supported.

Fundamentally, this module is designed so that users can easily parse and manipulate Java Properties files - that’s it. There’s a fair number of us pythonistas who work in multi-language shops, and constantly writing your own parsing mechanism is just painful. Not to mention Java guys are notoriously unwilling to use anything which is cross-language for configuration, unless it’s XML, which is a form of self-punishment. :)

Python support

The module is cross Python2 and Python3 compatible.

This module has basic support for Python3. It means the tests should pass under any version of Python3 though it has been tested only for versions >= Python 3.6.6.

Due to the changes for Python3, this should work under any Python2 version >= Python 2.7.


The code still uses Python2 type strings inside. In other words proper unicode support is still missing.


Here is a plan for the current version which runs under Python2 in approximate decreasing priority order.

  1. Keep/maintain blank lines and comments found in the original file

  2. Add unicode support

  3. Provide python property access on top of direct dictionary get/set

  4. Make the module compatible with the new methods in latest J2SE.


from pyjavaproperties import Properties
p = Properties()
print p
print p.items()
print p['name3']
p['name3'] = 'changed = value'
print p['name3']
p['new key'] = 'new value''','w'))

See also the Properties.list() method, which will return an iterator over the property keys


$ python

Changes & News

version 0.7

  • for release 0.7.

  • Created CHANGELOG.txt

  • Updated showing tests, changes section and updates to author etc.

  • Relicensed to MIT from PSF.

  • Rewrote N.B’s patch to relicense repo under MIT.

  • Basic python3 support plus python2/3 cross compatibility.

  • Absorbing TODO in

  • README =>

  • Added support for referenced properties.

  • Added tests for referenced properties and saving as well.

  • Minor tweaks in code.

  • Code moved to new git repo.

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

pyjavaproperties-0.7.tar.gz (8.1 kB view hashes)

Uploaded Source

Built Distribution

pyjavaproperties-0.7-py3-none-any.whl (7.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