import os
import re
import sys

# APPROCHE UTILISANT LES LISTES PAR EXTENSION
def ls(path, pattern):
   files = os.listdir(path)
   regexp = re.compile(pattern, re.IGNORECASE)
   return [f for f in files if regexp.search(f)]

print "\n".join(ls(os.getcwd(), sys.argv[1]))

# APPROCHE UTILISANT LA FONCTION FILTER()
def lsa(path, pattern):
   files = os.listdir(path)
   regexp = re.compile(pattern, re.IGNORECASE)
   return filter(regexp.search, files)

print "\n".join(lsa(os.getcwd(), sys.argv[1]))
