On Fri, Feb 10, 2017 at 12:05 AM, Wildman via Python-list
<python-list@python.org> wrote:
>
> Corrected code:
>
> def which(target)
>     for p in pathlist:
>         fullpath = p + "/" + target
>         if os.path.isfile(fullpath) and os.access(fullpath, os.X_OK):
>             return fullpath, True
>     return None, False

Use shutil.which:

https://docs.python.org/3/library/shutil.html#shutil.which
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to