python-jproperties
==================
[](https://travis-ci.org/translate/python-jproperties)
A python library for parsing and handling Java .properties files.
Installation
------------
```
$ pip install jproperties3
```
Test
----
```
$ python setup.py test
```
Build
-----
```
$ python setup.py build
```
Usage
-----
A Properties object is, on the outside, a simple key-value store.
Initialize it as such:
```python
from jproperties import Properties
p = Properties()
# Or with default values:
p2 = Properties({"foo": "bar"})
print(p2["foo"])
```
The usual dictionary interfaces are available:
```python
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:
```python
with open("out.properties", "w") as f:
f.write(str(p2))
```
To read an existing properties file, create the instance using the `stream`
keyword parameter
```python
with open("out.properties", "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:
```python
p3 = Properties(p2.keys())
```
### License
This project is licensed under the MIT license. The full license text is
available in the LICENSE file.
==================
[](https://travis-ci.org/translate/python-jproperties)
A python library for parsing and handling Java .properties files.
Installation
------------
```
$ pip install jproperties3
```
Test
----
```
$ python setup.py test
```
Build
-----
```
$ python setup.py build
```
Usage
-----
A Properties object is, on the outside, a simple key-value store.
Initialize it as such:
```python
from jproperties import Properties
p = Properties()
# Or with default values:
p2 = Properties({"foo": "bar"})
print(p2["foo"])
```
The usual dictionary interfaces are available:
```python
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:
```python
with open("out.properties", "w") as f:
f.write(str(p2))
```
To read an existing properties file, create the instance using the `stream`
keyword parameter
```python
with open("out.properties", "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:
```python
p3 = Properties(p2.keys())
```
### License
This project is licensed under the MIT license. The full license text is
available in the LICENSE file.
Release files for jproperties3 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jproperties3-0.5.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Release files / jproperties3-0.5.2-py2.py3-none-any.whl
| Download URL | jproperties3-0.5.2-py2.py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
015ac509a85d8d9af9dca0d82383f58c1827c8bce4b9b105da36504467f81f9d
|
|
BLAKE2b-256 checksum How to use checksums |
9df46f30e3d98eaadf6994d85dfb1f57dca63d7e76319a9d34e8807fb50facf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |