lxml etree.parse MemoryAllocation Error
问题 I'm using lxml etree.parse to parse a, somehow, huge XML file (around 65MB - 300MB). When I run my stand alone python script containing the below function, I am getting a Memory Allocation failure: Error: Memory allocation failed : xmlSAX2Characters, line 5350155, column 16 Partial function code: def getID(): try: from lxml import etree xml = etree.parse(<xml_file>) # here is where the failure occurs for element in xml.iter(): ... result = <formed by concatenating element texts> return result