Current drive and directory

Heather Coppersmith me at privacy.net
Thu May 27 03:32:27 EDT 2004


On Wed, 26 May 2004 20:33:43 -0400,
"George Kinney" <gk_2345 at yahoo.com> wrote:

> "EAS" <eriksp at attbi.nospam.com> wrote in message
> news:LP7tc.64476$gr.6380832 at attbi_s52...
>> Does anyone know how to display the current directory using DOS
>> and/or Python? I already tried os.pardir and os.curdir in Python, but all
>> they return are
>> a couple of periods...
>> 
>> >>>import os
>> >>>print os.curdir
>> .
>> >>>print os.pardir
>> ..


> maybe this?
> import os
> os.listdir(os.path.abspath('.'))

Or, using the information we gained by peeking at os.curdir:

    os.listdir( os.path.abspath( os.curdir ) )

I know the OP said DOS, but that may change some day.

Regards,
Heather

-- 
Heather Coppersmith
That's not right; that's not even wrong. -- Wolfgang Pauli



More information about the Python-list mailing list