Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31545
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <tharanga.abeyseela@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.040 |
| X-Spam-Evidence | '*H*': 0.92; '*S*': 0.00; 'root': 0.04; 'python': 0.09; 'subject:remove': 0.16; 'subject:Issue': 0.17; 'thanks,': 0.18; 'trying': 0.21; 'import': 0.21; 'error.': 0.21; 'skip:# 10': 0.27; 'tree': 0.27; 'message-id:@mail.gmail.com': 0.27; "i'm": 0.29; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'path': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'child': 0.36; 'received:209': 0.37; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'subject::': 0.83; 'subject:Search': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=eBSX2aPbg/4vNSY/aaA+JQe1ZDxetTxiOgaW5qRY7ck=; b=CwMXStG773qgHhDa82jylFRln7hxGqvKNJBppNuonatjHH66EZyd90JT9CY9Z5DvRD M0w7+3s8jY+vfPGCh4ZV0eKd1i7YJozsYFULSKIxuSqYvOWIgKzLdvamUBOT3gS7j7mC PmO3KBjzQlysPO5p0i63oKNlBj43AeT2nKS6bWrDijR/0oNBpT4fWQjbus0vW0AwZ9Ek 0RzGoKLvo3quNnkLL6wDTlKUNAkyaJ7DigGtTv4hGOJNFkQFD5YMtJG8NYrbEva/4Yeg 8+Em+pJ81yr2U+FuGSCw5qgTlbA+3gwqTWJEr0OZ+qd9LkhmuFjlEWFcyOFxWEA94J65 cgWA== |
| MIME-Version | 1.0 |
| Date | Thu, 18 Oct 2012 09:31:39 +1100 |
| Subject | re:ElementTree Issue - Search and remove elements |
| From | Tharanga Abeyseela <tharanga.abeyseela@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2368.1350513108.27098.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1350513108 news.xs4all.nl 6971 [2001:888:2000:d::a6]:38095 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31545 |
Show key headers only | View raw
Hi,
Thanks Alian, i was trying to use the following , but i got a path
separator error. I'm using python 2.4.3. is there any otherway i can
use this on 2.4.3
#!/usr/bin/env python
import elementtree.ElementTree as ET
tree = ET.parse('test.xml')
root = tree.getroot()
for child in root.findall(".//*[ParentalControl]"):
x = child.find("ParentalControl/Rating").text
if x == "NC":
root.remove(child)
Thanks,
Tharanga
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
re:ElementTree Issue - Search and remove elements Tharanga Abeyseela <tharanga.abeyseela@gmail.com> - 2012-10-18 09:31 +1100
csiph-web