copying all data(tags and values) after a particular XML tag
cwitts at gmail.com
Thu Mar 13 07:43:50 CET 2008
On Mar 13, 8:21 am, bije... at gmail.com wrote:
> i've an XML file with the following structure....
> what i want to do is copy all data(tags and all) between N and N+k
> appearances of <c>. I am a python newbie. How do I do it?
You can take a look at the docs for Beautiful Soup, they might help
you. If it's just as simple as you're describing and you could always
do something like...
test = """<a>
test = test.replace('<c>','|||').replace('</c>','|||')
[i for (j,i) in enumerate(tmp2.split('|')) if j%2]
which would yield
['\n 1\n ', '\n 2\n ']
which you could then parse as required.
More information about the Python-list