标签:style dump coding span text int element roo imp
1 # coding:utf-8 2 ‘‘‘ 3 auther:sds 4 ‘‘‘ 5 import xml.etree.ElementTree as ET 6 class Pyxml(): 7 def __init__(self,filename): 8 self.filename=filename 9 self.tree = ET.parse(filename) 10 self.root = self.tree.getroot() 11 def find(self): 12 country = self.root[0] 13 14 last_ele = country[len(list(country)) - 1] 15 print(len(list(country))) 16 last_ele.tail = ‘\n\t\t?????\n\t\t?????‘ 17 elem5 = ET.Element("test_insert") 18 elem5.text = "elem 5" 19 country.insert(60, elem5) 20 #ET.dump(country) 21 22 23 24 class test(): 25 def __init__(self): 26 a=Pyxml("tests/test.xml") 27 a.find() 28 test()
标签:style dump coding span text int element roo imp
原文地址:https://www.cnblogs.com/shends/p/10067851.html