This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author WoodyWoo
Recipients WoodyWoo
Date 2020-09-30.14:20:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601475625.07.0.195514916094.issue41892@roundup.psfhosted.org>
In-reply-to
Content
#Just run it in Python v3.8.6 of win7 32bit 
import xml.etree.ElementTree as ET 
xmlstr='''<root>
<a no="1"/>
<b/>
<c/>
</root>'''
etroot = ET.fromstring(xmlstr)
for ELEMchild in etroot:
    if ELEMchild.get("no") == "1" :
        etroot.remove(ELEMchild)       #so far so good
    print (ELEMchild.tag)
    #It should be :  "b /n c" or "a /n b /n c",I can live with it both.
    #But it is :  "a /n c".
    #The index of ELEMchild should not +1 when there was a remove method worked on one of the before ELEMs.
    #I was forced to use while and if to control the index +1/+0.
    #BTW,ELEM has no method returning index in siblings, which is buging me too.
History
Date User Action Args
2020-09-30 14:20:25WoodyWoosetrecipients: + WoodyWoo
2020-09-30 14:20:25WoodyWoosetmessageid: <1601475625.07.0.195514916094.issue41892@roundup.psfhosted.org>
2020-09-30 14:20:25WoodyWoolinkissue41892 messages
2020-09-30 14:20:24WoodyWoocreate