Parsing blank XML tags with LXML and Python

后端 未结 4 1784
自闭症患者
自闭症患者 2021-01-26 12:58

When parsing XML documents in the format of:


    Blue
    Chevy
    Camaro         


        
4条回答
  •  囚心锁ツ
    2021-01-26 13:58

    I don't know if there's a better solution built inside lxml, but you could just use .get():

    print parsedCarData[0].get('Model', '')
    

提交回复
热议问题