README.rst edit
Dave Cinege
2 years ago
3 | 3 | |
4 | 4 | See the end of this file for further copyright and license information |
5 | 5 | |
6 | Quick look | |
7 | ---------- | |
8 | :: | |
9 | ||
10 | from thesaurus import thes, Keypath | |
11 | t = thes() | |
12 | t.set_path('a.b.c.d', 'Hello') | |
13 | print(t['a']['b']['c']['d']) # as nested items | |
14 | print(t.a.b.c.d) # as attributes | |
15 | print(t.a.b['c'].d) # as both | |
16 | kp = Keypath('a.b.c.d') | |
17 | print(t[kp]) # as a keypath | |
18 | ||
19 | >>> 'a.b.c.d' in t | |
20 | True | |
21 | >>> kp[:-2] in t | |
22 | True | |
23 | >>> print(kp) | |
24 | 'a.b.c.d' | |
25 | >>> print(repr(kp)) | |
26 | ['a', 'b', 'c', 'd'] | |
27 | ||
6 | 28 | |
7 | 29 | Quick start |
8 | 30 | ------------ |
9 | $ python thesauruscfg_sample.py | |
31 | :: | |
32 | ||
33 | $ python thesauruscfg_sample.py | |
10 | 34 | |
11 | 35 | Then review thesauruscfg_sample.py and thesauruscfg_sample.cfg |
12 | 36 | and you will get an idea what Thesaurus and ThesaurusCfg |