thank you Stefan. but the XML output is assigned to a variable; how to
process the variable with XML contents?

On Wed, May 16, 2012 at 7:53 PM, Stefan Behnel <stefan...@behnel.de> wrote:

> Nibin V M, 16.05.2012 16:16:
> > I am trying to use cPanel XML-API and every API call return data in XML
> > format. I would like to know how to manipulate the data here.
> >
> > For eg: How can I read the CPU load data from the below output
> >
> >
> >
>  
> <loadavg><one>0.00</one><five>0.00</five><fifteen>0.00</fifteen></loadavg><!--
> > whostmgrd -->
>
> Here's some untested code to print the text values:
>
>  import xml.etree.ElementTree as ET
>
>  loadavg = ET.fromstring('<loadavg><one>0.00</one><five>0.00</five>'
>                          '<fifteen>0.00</fifteen></loadavg>')
>
>  for interval_tag in ('one', 'five', 'fifteen'):
>      print(loadavg.findtext(interval_tag))
>
>
> Stefan
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Regards....

Nibin.

http://TechsWare.in
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to