On May 3, 9:58 am, pradeep nair <[EMAIL PROTECTED]> 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)
.")[len(i.split("."))-1] == grep:
> > > lst.append(i)
> > > print lst
>
> > > On 2 May 2007 21:58:41 -0700, pradeep nair <[EMAIL PROTECTED]> wrote:
> > > > HI,
>
> > > > How do i find files with .so extension
grep="so"
> > dir="."
> > lst = os.listdir(dir)
> > filelst=[]
> > for i in lst:
> > if i.split(".")[len(i.split("."))-1] == grep:
> > lst.append(i)
> > print lst
> >
> >
> &
May be this would work
import os
grep="so"
dir="."
lst = os.listdir(dir)
filelst=[]
for i in lst:
if i.split(".")[len(i.split("."))-1] == grep:
lst.append(i)
print lst
On 2 May 2007 21:58:41 -0700, pradeep nair <[EMAIL PROTECTED]> wr
On Wed, 02 May 2007 21:58:41 -0700, pradeep nair wrote:
> HI,
>
>
> How do i find files with .so extension using python .
import os
help(os.listdir)
help(os.walk)
help(os.path.splitext)
That should give you all the tools you need.
--
Steven D'Aprano
--
http:
HI,
How do i find files with .so extension using python .
--
http://mail.python.org/mailman/listinfo/python-list