久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='Fvtb7'></bdo><ul id='Fvtb7'></ul>

      <tfoot id='Fvtb7'></tfoot>
    1. <i id='Fvtb7'><tr id='Fvtb7'><dt id='Fvtb7'><q id='Fvtb7'><span id='Fvtb7'><b id='Fvtb7'><form id='Fvtb7'><ins id='Fvtb7'></ins><ul id='Fvtb7'></ul><sub id='Fvtb7'></sub></form><legend id='Fvtb7'></legend><bdo id='Fvtb7'><pre id='Fvtb7'><center id='Fvtb7'></center></pre></bdo></b><th id='Fvtb7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Fvtb7'><tfoot id='Fvtb7'></tfoot><dl id='Fvtb7'><fieldset id='Fvtb7'></fieldset></dl></div>

      <legend id='Fvtb7'><style id='Fvtb7'><dir id='Fvtb7'><q id='Fvtb7'></q></dir></style></legend>

    2. <small id='Fvtb7'></small><noframes id='Fvtb7'>

      1. Python ElementTree 默認(rèn)命名空間?

        Python ElementTree default namespace?(Python ElementTree 默認(rèn)命名空間?)
        <legend id='clgxK'><style id='clgxK'><dir id='clgxK'><q id='clgxK'></q></dir></style></legend>

          <tbody id='clgxK'></tbody>

        <i id='clgxK'><tr id='clgxK'><dt id='clgxK'><q id='clgxK'><span id='clgxK'><b id='clgxK'><form id='clgxK'><ins id='clgxK'></ins><ul id='clgxK'></ul><sub id='clgxK'></sub></form><legend id='clgxK'></legend><bdo id='clgxK'><pre id='clgxK'><center id='clgxK'></center></pre></bdo></b><th id='clgxK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='clgxK'><tfoot id='clgxK'></tfoot><dl id='clgxK'><fieldset id='clgxK'></fieldset></dl></div>
          • <tfoot id='clgxK'></tfoot>
              <bdo id='clgxK'></bdo><ul id='clgxK'></ul>

              1. <small id='clgxK'></small><noframes id='clgxK'>

                  本文介紹了Python ElementTree 默認(rèn)命名空間?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  有沒有辦法在 python ElementTree 中定義默認(rèn)/無前綴命名空間?這似乎不起作用...

                  Is there a way to define the default/unprefixed namespace in python ElementTree? This doesn't seem to work...

                  ns = {"":"http://maven.apache.org/POM/4.0.0"}
                  pom = xml.etree.ElementTree.parse("pom.xml")
                  print(pom.findall("version", ns))
                  

                  這也不是:

                  ns = {None:"http://maven.apache.org/POM/4.0.0"}
                  pom = xml.etree.ElementTree.parse("pom.xml")
                  print(pom.findall("version", ns))
                  

                  確實(shí)如此,但我必須為每個(gè)元素添加前綴:

                  This does, but then I have to prefix every element:

                  ns = {"mvn":"http://maven.apache.org/POM/4.0.0"}
                  pom = xml.etree.ElementTree.parse("pom.xml")
                  print(pom.findall("mvn:version", ns))
                  

                  在 OSX 上使用 Python 3.5.

                  Using Python 3.5 on OSX.

                  如果答案是否",您仍然可以獲得賞金 :-).我只是想從一個(gè)花了很多時(shí)間使用它的人那里得到一個(gè)明確的不".

                  if the answer is "no", you can still get the bounty :-). I just want a definitive "no" from someone who's spent a lot of time using it.

                  推薦答案

                  注意:對于 Python 3.8+,請參閱 這個(gè)答案.

                  NOTE: for Python 3.8+ please see this answer.

                  沒有直接的方法可以透明地處理默認(rèn)命名空間.正如您已經(jīng)提到的,為空命名空間分配一個(gè)非空名稱是一種常見的解決方案:

                  There is no straight-forward way to handle the default namespaces transparently. Assigning the empty namespace a non-empty name is a common solution, as you've already mentioned:

                  ns = {"mvn":"http://maven.apache.org/POM/4.0.0"}
                  pom = xml.etree.ElementTree.parse("pom.xml")
                  print(pom.findall("mvn:version", ns))
                  

                  請注意,lxml.etree 不允許顯式使用空命名空間.你會得到:

                  Note that lxml.etree does not allow the use of empty namespaces explicitly. You would get:

                  ValueError:ElementPath 中不支持空的命名空間前綴

                  ValueError: empty namespace prefix is not supported in ElementPath


                  您可以通過 在加載 XML 輸入數(shù)據(jù)時(shí)刪除默認(rèn)命名空間定義:

                  import xml.etree.ElementTree as ET
                  import re
                   
                  with open("pom.xml") as f:
                      xmlstring = f.read()
                   
                  # Remove the default namespace definition (xmlns="http://some/namespace")
                  xmlstring = re.sub(r'sxmlns="[^"]+"', '', xmlstring, count=1)
                   
                  pom = ET.fromstring(xmlstring) 
                  print(pom.findall("version"))
                  

                  這篇關(guān)于Python ElementTree 默認(rèn)命名空間?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個(gè)模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點(diǎn)包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復(fù)導(dǎo)入頂級名稱的情況下構(gòu)造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動態(tài)共享庫的 Python 包)
                    <tbody id='G8TQ3'></tbody>

                            <bdo id='G8TQ3'></bdo><ul id='G8TQ3'></ul>

                            <small id='G8TQ3'></small><noframes id='G8TQ3'>

                            <legend id='G8TQ3'><style id='G8TQ3'><dir id='G8TQ3'><q id='G8TQ3'></q></dir></style></legend>

                          • <i id='G8TQ3'><tr id='G8TQ3'><dt id='G8TQ3'><q id='G8TQ3'><span id='G8TQ3'><b id='G8TQ3'><form id='G8TQ3'><ins id='G8TQ3'></ins><ul id='G8TQ3'></ul><sub id='G8TQ3'></sub></form><legend id='G8TQ3'></legend><bdo id='G8TQ3'><pre id='G8TQ3'><center id='G8TQ3'></center></pre></bdo></b><th id='G8TQ3'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='G8TQ3'><tfoot id='G8TQ3'></tfoot><dl id='G8TQ3'><fieldset id='G8TQ3'></fieldset></dl></div>
                            <tfoot id='G8TQ3'></tfoot>
                            主站蜘蛛池模板: 欧美一区二区三区视频 | 国产一区二区中文字幕 | 亚洲精品美女视频 | 一区二区在线视频 | 欧美寡妇偷汉性猛交 | 二区中文字幕 | 国产婷婷在线视频 | 欧美最猛黑人xxxⅹ 粉嫩一区二区三区四区公司1 | 国产精品综合网 | 亚洲午夜精品 | 精久久久 | 久久久久久久久久久高潮一区二区 | 1级黄色大片 | 日本精品视频在线观看 | 国产欧美日韩一区二区三区在线 | 你懂的国产 | 国产探花在线观看视频 | 成人精品一区 | 91视频免费 | 日韩视频免费看 | 欧美中文一区 | 欧美一级做a爰片免费视频 国产美女特级嫩嫩嫩bbb片 | 女人牲交视频一级毛片 | 免费午夜剧场 | av黄色免费在线观看 | 成人欧美一区二区三区在线播放 | 欧美日韩久久久久 | 日日夜夜天天干 | 97久久超碰 | 欧美国产中文字幕 | av在线一区二区三区 | 日韩手机在线视频 | 欧美专区在线 | 色婷婷av一区二区三区软件 | 国内精品久久久久久 | 国产女人第一次做爰毛片 | 日本午夜网 | 亚洲视频中文字幕 | 国产成人免费视频网站高清观看视频 | 欧美日韩一卡二卡 | 欧美日韩国产一区二区 |