A problem about File path encode

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Oct 10 11:55:58 CEST 2006


At Monday 9/10/2006 22:14, Kevien Lee wrote:

>   There is a problem about File path encode ,when i want to parse 
> an xml file.
>     xmldoc=minidom.parse("D:\Downloads\1.xml")
>IOError: [Errno 2] No such file or directory: 'D:\\Downloads\x01.xml'
>
>See the red line.the file path"D:\Downloads\1.xml" auto  changed 
>'D:\\Downloads\x01.xml'
>
>I think may be the version cause the problem (version2.4) at the 
>beginning,but when i changed the version2.5 ,

\ is a escape character. Use "D:\\Downloads\\1.xml" or 
r"D:\Downloads\1.xml" or "D:/Downloads/1.xml"
(I wrote this same message a few hours ago...!)



-- 
Gabriel Genellina
Softlab SRL 


	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas




More information about the Python-list mailing list