Python (de-)serializer for Cat Tree files.
This is just a toy, but maybe someone finds it useful.
not (yet) on PyPI
The cat tree file used in the following examples demo.ctr
:
# A demo cat tree
Food
Hot
Soup
Steak
Cold
Sandwich
Ice Cream
Drinks
Hot
Coffee
Tea # could be cold, though
Cold
Beer
Soda
from PyCatTree import Tree as CTree
ct = CTree('demo.ctr')
print(ct)
output
Food
Hot
Soup
Steak
Cold
Sandwich
Ice Cream
Drinks
Hot
Coffee
Tea
Cold
Beer
Soda
from PyCatTree import Tree as CTree
ct = CTree('demo.ctr')
whatever = ct.addChildNode('Whatever')
whatever.addChildNode('Foo')
whatever.addChildNode('Bar')
print(ct)
output
Food
Hot
Soup
Steak
Cold
Sandwich
Ice Cream
Drinks
Hot
Coffee
Tea
Cold
Beer
Soda
Whatever
Bar
Foo
from PyCatTree import Tree as CTree
new_ct = CTree()
foo = new_ct.addChildNode('Foo')
bar = new_ct.addChildNode('Bar')
foo.addChildNode('Beep')
foo.addChildNode('Boop')
bar.addChildNode('Meep')
bar.addChildNode('Moop')
print(new_ct)
output
Bar
Meep
Moop
Foo
Beep
Boop