Efficient way to iterate through xml elements

前端 未结 4 1898
走了就别回头了
走了就别回头了 2020-12-02 13:43

I have a xml like this:


    hello
    world


    

         


        
4条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 14:18

    bs4 is very useful for this

    from bs4 import BeautifulSoup
    raw_xml = open(source_file, 'r')
    soup = BeautifulSoup(raw_xml)
    soup.find_all('tags')
    

提交回复
热议问题