Skip to content

Instantly share code, notes, and snippets.

@bbigras
Created July 12, 2012 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbigras/3100108 to your computer and use it in GitHub Desktop.
Save bbigras/3100108 to your computer and use it in GitHub Desktop.
demo lambda
# -*- coding: utf-8 -*-
import os
path = "C:\\"
listeDeFichiers = os.listdir(path)
print "listeDeFichiers", listeDeFichiers
# Ne marche pas car listeDeFichiers ne contient que les noms de fichiers, pas les path
print "ne marche pas", filter(os.path.isfile, listeDeFichiers)
# marche
print "marche", filter(lambda nomFichier: os.path.isfile(os.path.join(path, nomFichier)), listeDeFichiers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment