Skip to content

Instantly share code, notes, and snippets.

@mikaelhg
Last active November 21, 2016 17:11
Show Gist options
  • Save mikaelhg/18a68fffa355c663549f6b845d7ad11f to your computer and use it in GitHub Desktop.
Save mikaelhg/18a68fffa355c663549f6b845d7ad11f to your computer and use it in GitHub Desktop.
Merge properties files

Merge .properties files

pip install -r requirements.txt
python props.py a.properties b.properties c.properties

Python

#!python2
from pyjavaproperties import Properties
from sys import argv
a, b = Properties(), Properties()
with open(argv[1], 'r') as fa, open(argv[2], 'r') as fb:
a.load(fa)
b.load(fb)
for k in a.propertyNames():
b.setProperty(k, a[k])
with open(argv[3], 'wb') as fc:
b.store(fc)
pyjavaproperties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment