Listar archivos

Jose Luis Dominguez NONLILLY DOMINGUEZ_JOSE_LUIS_NONLILLY en LILLY.COM
Mie Abr 26 18:11:27 CEST 2006


Gracias por las respuestas.

Me han ayudado mucho, sobre todo a mejorar mi conocimiento sobre Python ;)





Antonio Beamud Montero <antonio.beamud en linkend.net>
Sent by: python-es-bounces en aditel.org
26/04/2006 18:07
Please respond to La lista de python en castellano

 
        To:     La lista de python en castellano <python-es en aditel.org>
        cc: 
        Subject:        Re: [Python-es] Listar archivos


El mié, 26-04-2006 a las 17:56 +0200, Antonio Beamud Montero escribió:

Perdón:
--------------------------------------
import os

DIR = '.'
EXTS = ['.cpp','.h']


for root,dirs,names in os.walk(DIR):
    for name in names:
        remove = 1
        for ext in EXTS:
            if name.endswith(ext):
               remove = 0
    if remove: os.remove(os.path.join(root, name))
--------------------------------------

Así si


_______________________________________________
Python-es mailing list
Python-es en aditel.org
http://listas.aditel.org/listinfo/python-es




Más información sobre la lista de distribución Python-es