[Tutor] slashes in paths

Alan Gauld alan.gauld at btinternet.com
Sat Jul 20 22:46:00 CEST 2013


On 20/07/13 19:24, Jim Mooney wrote:
> I was looking at os.path.join, which is supposed to join paths
> intelligently.

It does including taking account of OS specific separators.
Which in the case of Windows is notionally the backslash.

The fact that you gave it a prefix containing forward
slashes is confusing things. It works best with a list
of individual folder names and let it provide the os.sep.
Try splitting your partial path before feeding it to join.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list