pyjavaproperties

Python replacement for java.util.Properties
Download

pyjavaproperties Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Jesse Noller
  • Publisher web site:
  • http://code.google.com/u/jnoller/

pyjavaproperties Tags


pyjavaproperties Description

Python replacement for java.util.Properties pyjavaproperties is a fork of the "python replacement for java.util.Properties" recipe on ASPN: < http://code.activestate.com/recipes/496795/ > and uploaded by Anand Balachandran Pillai.The project is primarily maintained by Jesse Noller.What this isThis module is designed to be a python equivalent to the java.util.Properties class. Currently, the basic input/output methods are supported, and there are plans to add the XML input/output methods found in J2SE 5.0.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.PlansHere is a rough plan of features: * Keep/maintain blank lines and comments found in the original file * Make the module compatible with the new methods in J2SE 5.0 * Switch to/add python property access rather than direct dictionary get/set * Add unit tests * Add unicode support * When-Pigs-Fly: If running within Jython, switch to java.util.Properties under the hood * Coercion/conversion to python types for valuesUsageThis is the easy part:from pyjavaproperties import Propertiesp = Properties()p.load(open('test2.properties'))p.list()print pprint p.items()print pp = 'changed = value'print pp = 'new value'p.store(open('test2.properties','w'))See also the Properties.list() method, which will return an iterator over the property keys. Requirements: · Python What's New in This Release: · Patch from Pepper Lebeck-Jobe for handling ! style comments.


pyjavaproperties Related Software