Removing part of string

half.italian at gmail.com half.italian at gmail.com
Mon May 14 04:04:41 EDT 2007


On May 13, 10:56 pm, saif.shak... at gmail.com wrote:
> Hi,
>     I am parsing an xml file ,and one part of structure looks
> something like this:
>
> - <COMPARAM id="_338" DDORef="_18" Semantics="timing"
> PhysicalLink="Infotainment_Control_Bus_CAN">
>   <SHORTNAME>Infotainment_Control_Bus_CAN_TIMEOUT_AX</SHORTNAME>
>   <LONGNAME>Timeout N_As/N_Ar</LONGNAME>
>   <DESCRIPTION>Time from transmit request until a CAN frame transmit
> confirmation is received.</DESCRIPTION>
>   </COMPARAM>
>
>                   In my code i am extracting the data within
> <LONGNAME>,which is Timeout N_As/N_Ar.These tags repeat and will have
> different timer names..like
>
> - <COMPARAM id="_339" DDORef="_18" Semantics="timing"
> PhysicalLink="Infotainment_Control_Bus_CAN">
>   <SHORTNAME>Infotainment_Control_Bus_CAN_TIMEOUT_BS</SHORTNAME>
>   <LONGNAME>Timeout N_Bs</LONGNAME>
>   <DESCRIPTION>Time that the transmitter of a multi-frame message
> shall wait to receive a flow control (FC) frame before timing out with
> a network layer error.</DESCRIPTION>
>   </COMPARAM>
>
>                  I need to remove the words Timeout from the data,and
> take only the abbrevation..i.e.N_As/N_bs like that .In short i have to
> remove the words which come with name Time,and also the space which
> comes next to it.
> and take only the abbreviation.Can someone help me in this.
>                      Thanks

Did you get elementtree working?




More information about the Python-list mailing list