-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_properties.py
More file actions
26 lines (23 loc) · 919 Bytes
/
test_properties.py
File metadata and controls
26 lines (23 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Custom parser for .properties file
def read_properties(file_path):
properties = {}
with open(file_path, 'r') as file:
for line in file:
line = line.strip()
if line and not line.startswith('#'): # Ignore empty lines and comments
key, value = line.split('=', 1)
properties[key.strip()] = value.strip()
return properties
# Read and use the properties
properties = read_properties('test.properties')
duration_min = int(properties['duration_min'])
duration_max = int(properties['duration_max'])
cnt_music = int(properties['cnt_music'])
request_count = int(properties['request_count'])
compress_degree = int(properties['compress_degree'])
# Print fields
print("Duration Min:", duration_min)
print("Duration Max:", duration_max)
print("Count Music:", cnt_music)
print("Request Count:", request_count)
print("Compress Degree:", compress_degree)