我正在尝试使用 minidom 将 xml 文件导入 python。
>>> from xml.dom import minidom
>>> import os
>>> xmldoc = minidom.parse('c/Users/WFD/Documents/VXWorks/XML_Parasing_Python')
即使我已经明确说明了它的位置,python 也找不到这个文件。我是 python 新手,所以如果出现明显错误,我深表歉意,但谁能解释如何在 mydocments 中导入 xml 文件?这是错误:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
xmldoc = minidom.parse('c/Users/WFD/Documents/VXWorks/XML_Parasing_Python')
File "C:\Python27\lib\xml\dom\minidom.py", line 1920, in parse
return expatbuilder.parse(file)
File "C:\Python27\lib\xml\dom\expatbuilder.py", line 922, in parse
fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: 'c/Users/WFD/Documents/VXWorks/XML_Parasing_Python'
谢谢!