gpt4 book ai didi

python - 我无法在 PyCharm 中导入 xml.dom.minidom。我可以尝试什么?

转载 作者:行者123 更新时间:2023-12-03 15:48:29 24 4
gpt4 key购买 nike

我正在尝试导入 xml.dom.minidom 但 pycharm 没有找到它,尽管它找到了 xml.entre/xml.parser/xml.sax。

其余的标准库工作正常。
xml 文件 (beispiel.xml) 应该不是问题,因为它的名称中没有“xml”。


from xml.dom import minidom

document = minidom.parse("beispiel.xml")

wanted_info = input("Which prduct do you want to see?")

product_list = document.getElementsByTagName(wanted_info)

for product in product_list:

for value in product.childNodes:
if value.nodeType == minidom.Node.ELEMENT_NODE:
print(value.tagName + ":" + value.firstChild.data)
print("\n")


我不确定,这可能是什么。可能是因为我在 D:... 中安装了 python,在 C:... 中安装了 pycharm,但我不认为这是问题所在。

Python and Pycharme project locations

最佳答案

升级到 2020.1 后,我遇到了同样的问题。该问题已在 Pycharm issue tracker 中报告.

在那里他们提出了以下解决方法,直到问题得到解决:

Replace xml directory in <INSTALLATION_FOLDER>\plugins\python(-ce)\helpers\typeshed\stdlib\2and3\ with xml from https://github.com/python/typeshed/tree/master/stdlib/2and3/xml



在我的机器上,这解决了问题。

关于python - 我无法在 PyCharm 中导入 xml.dom.minidom。我可以尝试什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61208926/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com