June 2000
Intermediate to advanced
556 pages
8h 45m
English
Pyxies provides a Cut method that allows you to cut a piece out of a tree—the cutting is itself an xTree object. The PasteDown and PasteRight methods can be used to insert a tree into another tree. The PasteDown method positions the inserted tree, as the first child of the active node. The PasteRight method positions the inserted tree to the right of the active node.
In the following example, the b element is moved to the left of “Hello” with cut and paste operations.
CD-ROM reference=12017.txt
C>type p15.py """ Move b element to the left of "Hello" using cut and paste operations. """ from pyxie import * import sys t = File2xTree (sys.argv[1]) NormalizeWhiteSpaceSMG(t) t.Down() t.Right() t1 = t.Cut() t.Home() t.PasteDown(t1) ...Read now
Unlock full access