<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                **Xpath:** Xpath是一門在HTML/XML?檔中查找信息的語言,可用來在HTML/XML文檔中對元素和屬性進行遍歷。 文檔:http://www.w3school.com.cn/xpath/index.asp <br/> **lxml:** lxml是Python的一個HTML/XML文檔解析器,利用`etree.HTML`函數將HTML/XML文檔轉換為Element對象,然后結合Xpath語法來解析HTML/XML文檔節點信息。 <br/> lxml官方文檔:http://lxml.de/index.html。 執行`pip install lxml`安裝。 <br/> lxml 可以?動修正 html/xml 代碼,如下為不全的html代碼。 ```html <div> <p>xpath,lxml</p> <ul> <li> <strong> Python </strong> </ul> ``` 使用lxml解析: ```python from lxml import etree text = """ <div> <p>xpath,lxml</p> <ul> <li> <strong> Python </strong> </ul> """ # (1)將html文檔轉換為Element對象 html = etree.HTML(text) print(etree.tostring(html).decode()) ``` 輸出如下: ```xml <html><body><div> <p>xpath&#65292;lxml</p> <ul> <li> <strong> Python </strong> </li></ul> </div></body></html> ``` 可見lxml自動補全了代碼。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看