README.rst edit
Dave Cinege
2 years ago
26 | 26 |
['a', 'b', 'c', 'd']
|
27 | 27 |
|
28 | 28 |
|
|
29 |
cfgs = '''
|
|
30 |
prog.version(static_int) = 123
|
|
31 |
opt.verbose (str_to_bool) = yes
|
|
32 |
hi = Hello
|
|
33 |
'''
|
|
34 |
from thesauruscfg import thescfg
|
|
35 |
cfg = thescfg()
|
|
36 |
>>> cfg.parse(cfgs)
|
|
37 |
{'prog': {'version': 123}, 'opt': {'verbose': True}, 'hi': 'Hello'}
|
|
38 |
|
|
39 |
|
29 | 40 |
Quick start
|
30 | 41 |
------------
|
31 | 42 |
::
|
20 | 20 |
|
21 | 21 |
import os
|
22 | 22 |
import sys
|
|
23 |
import json
|
|
24 |
|
23 | 25 |
|
24 | 26 |
from thesauruscfg import thescfg
|
25 | 27 |
|
|
38 | 40 |
|
39 | 41 |
print('cfg.dump()\n---')
|
40 | 42 |
print(cfg.dump())
|
|
43 |
print('---')
|
|
44 |
|
|
45 |
# thesauruscfg is perfect for JSON
|
|
46 |
print('json.dumps()\n---')
|
|
47 |
print(json.dumps(cfg, indent=4, separators=(',', ': ')))
|
41 | 48 |
print('---')
|
42 | 49 |
|
43 | 50 |
# abc is using the static_int() coercion method. The method not only
|