This is a read-write properties tool
Project description
这是一个读写properties工具 示例:见测试用例pr_properties/test_case/test_properties.py
from pr_properties import pr_properties
# 创建Properties对象
p = pr_properties.Properties()
# 读取字符
str_p = """# 读取字符=1
master.initialSize=4
master.minIdle=10=20=kk"""
p.loads(str_p)
# 修改
p['master.initialSize'] = 5
# 增加
p['master.cc'] = 5
# 输出对象的字符
print(p.dumps())
# 删除
del p['master.cc']
print(p.dumps())
# 读取properties文件
p = pr_properties.Properties()
p.read(path=r'./pool.properties')
print(p['master.initialSize']) # 4
# 修改
p['master.initialSize'] = 5
# 写入,写入后会关闭文件
p.write()
p.read(path=r'D:\WORK\PYTHON\my-python-tools\auto_exe\app\pool.properties')
# 验证是否修改
print(p['master.initialSize']) # 5
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pr_properties-1.7.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for pr_properties-1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c86b901125a40958a0904963b6558740e577a60050295f5beb600abd4a1ddd1 |
|
MD5 | 9114d8317294f9a8c614b835170a7421 |
|
BLAKE2b-256 | d58bfcf36857eefdd358c11ab1f8d639bace2bff0c86cac8044770bf2e0040b8 |