Support for Windows 7 ?

Tim Roberts timr at probo.com
Sat Sep 5 17:02:25 EDT 2009


Pascale Mourier <Pascale.Mourier at ecp.fr> wrote:
>
>YES IT IS! Sorry for the inconvenience. I usually start from this 
>assumption. Yesterday this new student was really agressive, and I 
>assumed he was right!
>
>Here's his mistake: with Windows the name of the directory rooted at a 
>drive name (say C:) is called 'C:\' not 'C:', and it's been that way for 
>ages.

The root of drive C: is, indeed, spelled "C:\".  However, the spelling "C:"
has a well-defined meaning, and it has since MS-DOS 2 when directories were
introduced.  It means "the current directory for C:".

>Well, os.listdir('C:') instead of raising an exception, for some reason 
>behaves like os.listdir('.').

Because it's not an exception.  The meaning is well-defined.  This can be
very handy, for example, when copying between deeply nested paths on
different drives:

    D:
    cd "\Ridiculous\Long\Path\Names\For Annoyance"
    C:

    cd "\Another\Ridiculous\Long\Path\Name"
    copy C:one.txt D:two.txt
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list