from xml.dom.minidom import parse
import xml.dom.minidom
#打開xml文檔
dom = xml.dom.minidom.parse('newmy.xml')
#轉爲字符串
collection = dom.documentElement.toxml()
print(type(collection))
#轉Beautiful
soup=BeautifulSoup(collection,'lxml')
print(type(soup))
python打開xml文件並轉爲Beautiful格式
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
使用Beautifulsoup解析網頁遇到的問題
李孟笛
2020-07-07 18:21:30
Android5.0 DatePicker 和 TimePicker 恢復至低版本滾動選擇模式
切莫er
2020-06-27 08:42:32
【筆試】龍圖遊戲服務器開發筆試記錄
爱放火的安小妮
2020-06-22 12:01:22
Mybatis批量操作sql寫法
小布吉岛
2020-06-20 04:01:40
ubuntu18 安裝Qt5.13問題記錄 ---QT5:unable to create the directory&&Error while building/deploying project
小雷家家-LeiJin
2020-06-19 05:18:33
使用anaconda新建各種python版本虛擬運行環境(附pycharm設置運行環境)筆記
李孟笛
2020-06-13 04:05:22
python兩列表對應元素求和
李孟笛
2020-06-13 04:05:22
求列表內元素總和
total = 0 list1 = [2, 3, 5] for x in range(0, len(list1)): total = total + list1[x] print( total)
李孟笛
2020-06-13 04:05:22
python使用replace做多字符替換
李孟笛
2020-06-13 04:05:22
獲取多進程函數返回值
李孟笛
2020-06-13 04:05:12
圖片文字識別各種方法比較
李孟笛
2020-06-13 04:05:12
PotPlayer不支持S/W HEVC(H.265)解碼的解決方法
驭风者yuzhansheng
2020-06-10 19:03:14
解決如source insight等軟件由於編碼格式不一樣出現中文亂碼顯示問題
小雷家家-LeiJin
2020-06-09 15:09:32
Android自定義衛星菜單
有点感觉
2020-05-31 02:02:30