Outils pour utilisateurs

Outils du site


francois:localiser_en_python_un_exe_dans_le_path

localiser un exe dans le path

whereis.py
def whereis(program, verbose=False):
    for path in sys.path:
        p = os.path.normpath(os.path.join(path, program))
        if verbose:
            print('in: "' + path + '" ->', end='')
        if os.path.exists(p) and not os.path.isdir(p):
            if verbose:
                print('yes')
            return p
        else:
            if verbose:
                print('no')
    return None
francois/localiser_en_python_un_exe_dans_le_path.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki