Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79083

Re: Jython or Pyton issue-- Kindly Help me....

Newsgroups comp.lang.python
Date 2014-10-14 02:46 -0700
References <91eb3378-958d-45e0-8741-a800ae681260@googlegroups.com> <mailman.14825.1413215053.18130.python-list@python.org>
Message-ID <552277f6-fb5b-44de-a0d4-7c7fe480d265@googlegroups.com> (permalink)
Subject Re: Jython or Pyton issue-- Kindly Help me....
From Venugopal Reddy <venugopal.reddy@tspl.com>

Show all headers | View raw


Ok, I will explain my problem in details :

I have below XML:

<?xml version="1.0"?> 
<data> 
    <country name="Liechtenstein"> 
        <rank>1</rank> 
        <year>2008</year> 
        <year>2009></year> 
        <gdppc>141100</gdppc> 
        <neighbor name="Austria" direction="E"/> 
        <neighbor name="Switzerland" direction="W"/> 
    </country> 
    <country name="Singapore"> 
        <rank>4</rank> 
        <year>2011</year> 
        <gdppc>59900</gdppc> 
        <neighbor name="Malaysia" direction="N"/> 
    </country> 
    <country name="Panama"> 
        <rank>68</rank> 
        <year>2011</year> 
        <gdppc>13600</gdppc> 
        <neighbor name="Costa Rica" direction="W"/> 
        <neighbor name="Colombia" direction="E"/> 
    </country> 
</data> 


From I want output below format:

Countryname    Rank    Year    gdppc 
Liechtenstein   1      2008    141100 
Singapore       4      2011    59900 
Panama          68     2011    13600

Please help how to do it..


On Monday, October 13, 2014 9:14:27 PM UTC+5:30, Ian wrote:
> On Mon, Oct 13, 2014 at 5:39 AM, Venugopal Reddy
> 
> <venugopal.reddy@tspl.com> wrote:
> 
> > Dear All,
> 
> >
> 
> > How to write a program for reading or parsing the XML file in Sub root Wise.
> 
> 
> 
> I don't know what "Sub root Wise" is. You can find an overview of
> 
> Python's XML parsing interfaces at
> 
> https://docs.python.org/2/library/xml.html. I would recommend using
> 
> the ElementTree API unless you have a specific reason to use something
> 
> else.

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Jython or Pyton issue-- Kindly Help  me.... Venugopal Reddy <venugopal.reddy@tspl.com> - 2014-10-13 04:39 -0700
  Re: Jython or Pyton issue-- Kindly Help me.... Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-13 09:43 -0600
    Re: Jython or Pyton issue-- Kindly Help me.... Venugopal Reddy <venugopal.reddy@tspl.com> - 2014-10-14 02:46 -0700
      Re: Jython or Pyton issue-- Kindly Help me.... Peter Otten <__peter__@web.de> - 2014-10-14 12:43 +0200
        Re: Jython or Pyton issue-- Kindly Help me.... Venugopal Reddy <venugopal.reddy@tspl.com> - 2014-10-14 22:42 -0700
          Re: Jython or Pyton issue-- Kindly Help me.... Peter Otten <__peter__@web.de> - 2014-10-15 09:32 +0200
            Re: Jython or Pyton issue-- Kindly Help me.... Venugopal Reddy <venugopal.reddy@tspl.com> - 2014-10-15 01:35 -0700
              Re: Jython or Pyton issue-- Kindly Help me.... Peter Otten <__peter__@web.de> - 2014-10-15 11:04 +0200

csiph-web