At 07:06 PM 10/6/2010 +0200, Friedrich Romstedt wrote:
2010/10/6 Fred Drake <fdr...@acm.org>:
> On Wed, Oct 6, 2010 at 12:54 PM, Friedrich Romstedt
> <friedrichromst...@gmail.com> wrote:
>> It's in my
>> opinion always a good idea to try to avoid hard-coding directory
>> separators (/), and to use os.path.join() instead.
>
> Distutils specifically wants "/" rather than the local platform's
> separator, and takes care of conversion as needed.

Sure, thanks for the correction!  Don't know if glob would need
platform-specific separators, though?

glob accepts '/' on most platforms, but returns platform-specific separators. For this application, though, it's simpler to just use ['prefix/'+f for f in os.listdir('prefix')].

Or, if you like obfuscational, er, I mean, functional programming, you can user:

    map('prefix/'.__add__, os.listdir('prefix'))

;-)

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to