[Tutor] os.path.basename() issue with path slashes

Shashwat Anand anand.shashwat at gmail.com
Sun Feb 21 01:36:10 CET 2010


>
>
>
> If you're using OS functions you should NOT bank on the slashes being
> forward-slashes.  This is platform-specific behavior.  You should use
> os.path.split() to get the elements of your path and do a "/".join() on
> them.  Otherwise your code will break on Windows because the path will be
> denoted with backslashes.
>
>
What about replacing os.path with posixpath ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100221/7b525e67/attachment.html>


More information about the Tutor mailing list