How to test if two strings point to the same file or directory?

Erik Max Francis max at alcyone.com
Sun Dec 17 00:30:45 EST 2006


Leif K-Brooks wrote:

> ~ is interpreted as "my home directory" by the shell, but when it's used 
> in a path, it has no special meaning. open('~/foo.txt') tries to open a 
> file called foo.txt in a subdirectory of the current directory called '~'.

That's what os.path.expanduser is for.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
   It is much safer to obey than to rule.
    -- Thomas a Kempis



More information about the Python-list mailing list