Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31479
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; 'root': 0.04; '#print': 0.09; 'iterate': 0.09; 'elt': 0.16; 'found"': 0.16; 'here..': 0.16; 'subject:remove': 0.16; 'subject:Issue': 0.17; 'thanks,': 0.18; 'import': 0.21; 'values': 0.26; 'checking': 0.27; 'tree': 0.27; 'message-id:@mail.gmail.com': 0.27; 'parent': 0.29; 'url:06': 0.29; 'this.': 0.29; 'stuff': 0.30; 'file': 0.32; 'print': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'remove': 0.61; 'here': 0.65; 'url:2011': 0.72; '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=q8k9lu97PIIOqZhehxQk5HA+Iz+CZjmmaw+7Aq18Nmg=; b=gO01107x2I3KQ2giiyaJ/81Ju45sHDh8vMB46AHmjEmxPVYxvhpIjQIFdl5c1KQzK/ +Jc9nw/9yl5vHVERhjcU/nnKl32PRcwFKuHogii+302QOJZrItQjHP9zzZ7MK3rX2QxI 82v6FSCUIfGP0DDqM/Z1auHfw3YWIp9KtMskBztYhe0h111btOMiLf3BNRfwl0DA3OZR oDL1I0cFkyfdSI20JVSlr1a8Y/RC4wqt3naYXFr7opfwm38nixIKsS2uvI/HEI7Jb014 uoDRHxiTwnibWZwvyYEf9/AuLfJjEkX41y3xp1S9G+OSLhgo23yRCnDD8bRwRYg2fJEF QRbA== |
| MIME-Version | 1.0 |
| Date | Wed, 17 Oct 2012 18:19:06 +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.2329.1350458350.27098.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1350458350 news.xs4all.nl 6900 [2001:888:2000:d::a6]:46091 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31479 |
Show key headers only | View raw
Thanks Stefan,
i managed to iterate through the file like this.
import elementtree.ElementTree as ET
tree = ET.parse('test.xml')
root = tree.getroot()
walkAll = tree.getiterator()
for elt in walkAll:
#print elt.tag
x = elt.tag
if x == "{http://xxxx.xx.com/xxxx/2011/06/13/ingestion}Rating":
if elt.text == "NC":
print elt.text #### here i can see all my NC values
else:
print "not found" ####all other stuff are coming here..
but how should i remove the parent from the NC checking part?
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-17 18:19 +1100
csiph-web