[Olpc-uruguay] os python

Andrés Ambrois andresambrois en gmail.com
Mie Jul 6 19:14:59 EDT 2011


On Wednesday, July 06, 2011 07:47:15 pm Cristhofer Travieso wrote:
> Alguien sabe un comando del modulo os de python,
> que devuelva si cierto comando existe en bash

Lo tenés que hacer a mano:

 def existe_comando(comando):
     for dir in os.environ['PATH'].split(':'):
         ruta = os.path.join(dir, comando)
         if os.path.exists(ruta) and os.access(ruta, os.X_OK):
             return ruta

> -- 
> *Cristhofer Travieso <http://cristhofer-t.blogspot.com>*
> 

-- 
  -Andrés
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.laptop.org/pipermail/olpc-uruguay/attachments/20110706/dcdea26b/attachment-0001.pgp>


More information about the Olpc-uruguay mailing list