-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
50 lines (39 loc) · 894 Bytes
/
README
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# pywrapper-config
Wrapper to ConfigParser
tests.conf file:
```
[time]
pidfile_timeout = 5
[server]
ip = "127.0.0.1"
port = "8080"
```
tests2.conf file:
```
[time]
sleep = 3
[paths]
null = /dev/null
stdout = /dev/tty
stderr = /dev/tty
[conex]
port = 9080
```
How to use pywraper-config:
```
import pywrapper_config
config = pywrapper_config.Config("./tests.conf")
#Show sections
print("Sections: {0} ".format(config.show_sections()))
#Show server section
print("Items server section: {0} ".format(config.show_item_section("server")))
#Show ip server
print("IP: {0}".format(config.show_value_item("server","ip")))
#Show config file
print("Config file: {0}".format(config.cnffile))
#Change config file
config.cnffile = "./conf/tests2.py"
print("Config file: {0}".format(config.cnffile))
#Show sections from new config file
print("Secciones: {0}".format(config.show_sections()))
```