whichみたいなの、というか、外部プログラムを起動したいときに/usr/local/binにあるのか/opt/local/binにあったりするのだけどいちいち意識しなくていいようにスクリプト中で探したい。 例えばgaston >>> filter(lambda f: os.path.isfile(f),[os.path.join(d,'gaston') for d in os.environ['PATH'].split(':')]) ['/opt/local/bin/gaston', '/opt/local/bin/gaston'] 最初にヒットしたものだけ >>> filter(lambda f: os.path.isfile(f),[os.path.join(d,'gaston') for d in os.environ['PATH'].split(':')])[0] '/opt/l
![pythonでコマンドを探す](https://cdn-ak-scissors.b.st-hatena.com/image/square/e3356803e0ca2fbf81750674b5e9ef63e7a486bc/height=288;version=1;width=512/http%3A%2F%2Fwww.kzfmix.com%2Fimages%2Fogp%2Fogp_logo.jpg)