Re: FInd files with .so extension

2007-05-03 Thread mailme . gurpreet
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)
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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FInd files with .so extension

2007-05-02 Thread pradeep nair
On May 3, 11:27 am, kaens <[EMAIL PROTECTED]> wrote:
> do YOU mean hit "reply to all" not "reply?"
>
> On 5/3/07, kaens <[EMAIL PROTECTED]> wrote:
>
> > do you mean
> > filelst.append(i)?
>
> > On 5/3/07, rishi pathak <[EMAIL PROTECTED]> wrote:
> > > 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]> wrote:
> > > > HI,
>
> > > >  How do i find files with .so extension using python .
>
> > > > --
> > > >http://mail.python.org/mailman/listinfo/python-list
>
> > > --
> > > Regards--
> > > Rishi Pathak
> > > National PARAM Supercomputing Facility
> > > Center for Development of Advanced Computing(C-DAC)
> > > Pune University Campus,Ganesh Khind Road
> > > Pune-Maharastra
> > > --
> > >http://mail.python.org/mailman/listinfo/python-list



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FInd files with .so extension

2007-05-02 Thread kaens
do YOU mean hit "reply to all" not "reply?"

On 5/3/07, kaens <[EMAIL PROTECTED]> wrote:
> do you mean
> filelst.append(i)?
>
> On 5/3/07, rishi pathak <[EMAIL PROTECTED]> wrote:
> > 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]> wrote:
> > > HI,
> > >
> > >
> > >  How do i find files with .so extension using python .
> > >
> > > --
> > > http://mail.python.org/mailman/listinfo/python-list
> > >
> >
> >
> >
> > --
> > Regards--
> > Rishi Pathak
> > National PARAM Supercomputing Facility
> > Center for Development of Advanced Computing(C-DAC)
> > Pune University Campus,Ganesh Khind Road
> > Pune-Maharastra
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FInd files with .so extension

2007-05-02 Thread rishi pathak

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]> wrote:


HI,


 How do i find files with .so extension using python .

--
http://mail.python.org/mailman/listinfo/python-list





--
Regards--
Rishi Pathak
National PARAM Supercomputing Facility
Center for Development of Advanced Computing(C-DAC)
Pune University Campus,Ganesh Khind Road
Pune-Maharastra
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: FInd files with .so extension

2007-05-02 Thread Steven D'Aprano
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://mail.python.org/mailman/listinfo/python-list


FInd files with .so extension

2007-05-02 Thread pradeep nair
HI,


 How do i find files with .so extension using python .

-- 
http://mail.python.org/mailman/listinfo/python-list