This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #sort a list of object based on an attribute or a method of the object | |
| from operator import attrgetter, methodcaller | |
| class Person(object): | |
| def __init__(self, name, age): | |
| self.age = age | |
| self.name = name | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #GetAllObjects | |
| def getAllObjects(): | |
| allObjs = [] | |
| def itterate(obj): | |
| while obj: | |
| allObjs.append(obj) | |
| itterate(obj.GetDown()) | |
| obj = obj.GetNext() | |
| return allObjs | |
| obj = doc.GetFirstObject() |