FInd files with .so extension

mailme.gurpreet at gmail.com mailme.gurpreet at gmail.com
Thu May 3 03:35:36 EDT 2007


On May 3, 9:58 am, pradeep nair <deep... at gmail.com> wrote:
> HI,
>
>      How do i find files with .so extension using python .

Hi pradeep


This piece of code should help you


import os,re

def findfile(filepattern, base = '.'):
    regex = re.compile(filepattern)
    matches = []
    for root,dirs,files in os.walk(base):
        for f in files:
          if regex.match(f):
             matches.append(root + '/' + f)
    return matches


HAPPY CODING




More information about the Python-list mailing list