Hume's doona
December 23rd, 2009, 02:38 AM
I know I should knoow this. I have a large xml file to convert to plain text, I just havve a simple question about substrings. Given the example:
<greeting>hello world</greeting><greeting>hello mars</greeting><greeting>hello jupiter</greeting><greeting>hello saturn</greeting><greeting>hello neptune</greeting>
How do I extract the second substring between the same brckets of <greeting>?
For the first, I knoow I use:
y=str(x)[str(x).find("<greeting>")+1:str(x).find("</greeting>")]
How do I then extract the second <greeting> to assign it to an instancce of the object greeting()?
I feel really stoopid asking this :oops:
Thanks for any help and happy holidays.
<greeting>hello world</greeting><greeting>hello mars</greeting><greeting>hello jupiter</greeting><greeting>hello saturn</greeting><greeting>hello neptune</greeting>
How do I extract the second substring between the same brckets of <greeting>?
For the first, I knoow I use:
y=str(x)[str(x).find("<greeting>")+1:str(x).find("</greeting>")]
How do I then extract the second <greeting> to assign it to an instancce of the object greeting()?
I feel really stoopid asking this :oops:
Thanks for any help and happy holidays.