[Tutor] python equivalent of perl readlink()?

Bill Campbell bill at celestial.net
Mon Oct 16 07:06:47 CEST 2006

On Sun, Oct 15, 2006, Michael P. Reilly wrote:
>   On 10/15/06, Bill Campbell <[1]bill at celestial.net> wrote:
>     Is there a python equivalent of the perl readlink() function
>     (e.g. one that returns the relative path in cases where a command
>     such as ``ln -s ls /usr/local/bin/gls'' created the link?
>     Reading the documentation on the various os.path functions, the
>     only thing I see returns the fully resolved path rather than the
>     relative one (/usr/local/bin/ls in the case above).
>     Bill
>   The function is in the os module ([2]
>   http://docs.python.org/lib/os-file-dir.html).

Silly me.  I was looking in the os.path module :-).


INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``Unix is simple. It just takes a genius to understand its simplicity'' --
    Dennis Ritchie

More information about the Tutor mailing list