os.path.normpath

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Aug 9 22:43:54 EDT 2006


At Wednesday 9/8/2006 15:45, nathanbullock at gmail.com wrote:

>I am using a windows box and passing a string like "../foo/../foo2" to
>normpath which then returns "..\\foo2". But if this string is going
>into a webpage link it should really be "../foo".

You could just .replace('\\','/') on the resulting string. Or use the 
urlparse module.

>Is there any way to tell os.path.normpath to act like we are an a unix
>style box?

The fact than '/' is used as a path separator both on unix and on 
HTTP URLs should be considered as a mere coincidence (in fact it isn't...)
URLs dont necesarily point to a real file on a real file system (Zope 
is an example).



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