[Tutor] Parse XML file
lagrapidis at yahoo.com
Sat Mar 14 23:47:22 CET 2009
Sorry please ignore... I changed the path to c:\temp\test.xml and it worked just fine.
I'm sure I'll have some questions when I actually start playing with it though.
From: Lukas Agrapidis <lagrapidis at yahoo.com>
To: tutor at python.org
Sent: Saturday, March 14, 2009 6:30:35 PM
Subject: [Tutor] Parse XML file
I am trying to parse an XML file using Python and found this resource
But I didn't even get past the second line... it does not see the xml file? But it is there.
>>> from xml.dom import minidom >>> xmldoc = minidom.parse('~/Desktop/test/test.xml')
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
xmldoc = minidom.parse('~/Desktop/test/test.xml')
File "C:\Program Files\python26\lib\xml\dom\minidom.py", line 1918, in parse
File "C:\Program Files\python26\lib\xml\dom\expatbuilder.py", line 922, in parse
fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: '~/Desktop/test/test.xml'
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor