Does os.getcwd() and os.curdir have the same effect ?

Thomas Jollans t at jollybox.de
Sun Sep 9 09:39:12 EDT 2012


On 09/09/2012 03:22 PM, iMath wrote:
> Does os.getcwd() and os.curdir have the same effect ?
> 

Python 3.2.3 (default, May  3 2012, 15:51:42)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd()
'/home/tjol'
>>> os.curdir
'.'
>>>


No.


Both refer to the current directory, but os.curdir is not an absolute
path, so you can't chdir() to it later and expect to land it the
original directory.



More information about the Python-list mailing list