我有一個我想解析的XML,然後將結果發送到一個txt文件。在Python中解析XML
XML文件是從塊建造像這樣的:
<rpc-reply message-id="12"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<user-stats>
<allocated-user-count>10</allocated-user-count>
<current-user-count>3</current-user-count>
<max-active-user-count-24hrs>2</max-active-usercount-
24hrs>
<min-active-user-count-24hrs>0</min-active-usercount-
24hrs>
</user-stats>
</rpc-reply>
所有塊將開始與和與
我想去除所有標籤,並得到由線的結果和將它們複製到文本文件中。例如:
allocated user count <tab> current-user-count <tab> max-user-count
100 <tab> 1<tab> 2<tab>
100 <tab> 0<tab> 2<tab> (info taken from the second RPC block)
等
有沒有什麼辦法可以做到這一點?