Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In python, how can I test if a path is a symbolic link?

Tags:

python

In python, how can I test if a path is a symbolic link? I'm sure it has to do with the os package, but my searching of the documentation text didn't yield a result. I'm using version 2.7 at the moment.

like image 283
Ross Rogers Avatar asked Feb 21 '23 14:02

Ross Rogers


1 Answers

Close, but no cigar. You want the os.path module. Check out os.path.islink().

like image 133
Gareth Latty Avatar answered Mar 08 '23 05:03

Gareth Latty