Task: Remove Elements from XML Using lxml in Python
Task: Remove Elements from XML Using lxml in Python: a task in Terminal-Lego-15k (Harbor dataset). Write a Python script that removes XML elements from a tree based on attribute values using the lxml library. Specifically, remove all <fruit elements where the state attribute equals "rotten" …
The task
Write a Python script that removes XML elements from a tree based on attribute values using the `lxml` library. Specifically, remove all `<fruit>` elements where the `state` attribute equals `"rotten"`, preserving the remaining elements and the overall tree structure.
Part of PrimeIntellect/Terminal-Lego-15k.