具體的數據我有這樣提取XML文件
<pr_id>01</pr_id>
<uniprot>O11482</uniprot>
<uniprot>O96642</uniprot>
<uniprot>Q67845</uniprot>
<column>
<column_id>1</column_id>
column_start>300</column_start>
<column_end>334</column_end>
<old_new>old</old_new>
<comment></comment>
</column>
<column>
<column_id>2</column_id>
<column_start>335</column_start>
<column_end>337</column_end>
<old_new>new</old_new>
<comment></comment>
<pr_id>02</pr_id>
<uniprot>P4455</uniprot>
<uniprot>89WER8</uniprot>
<uniprot>Q12845</uniprot>
<column>
<column_id>1</column_id>
<column_start>12</column_start>
<column_end>34</column_end>
<old_new>old</old_new>
<comment></comment>
</column>
<column>
<column_id>2</column_id>
<column_start>35</column_start>
<column_end>37</column_end>
<old_new>old</old_new>
<comment></comment>
我想獲得如下輸出XML文件。
pr_id uniprot old_start old_end
01 O11482 300 334
02 P4455 12 34
02 P4455 35 37
實現此目的的簡單方法是什麼?這是我第一次處理xml文件。您的寶貴意見將不勝感激!
確保XML的簡潔(wellformed)然後使用任何XML解析器。 – thefourtheye
可能的重複:[如何在python中解析XML?](http://stackoverflow.com/questions/1912434/how-do-i-parse-xml-in-python) – valverij
爲什麼你不想輸出列沒有。 2爲'pr_id = 01'? –