Barnaby Scott wrote:
For anyone who doesn't like lambda, how about
import os
def get_fles(exts, upd_dir):
return [i for i in os.listdir(upd_dir) if i.split('.')[-1] in exts]
Better would be:
def get_fles(exts, upd_dir):
return [fname for fname in os.listdir(upd_dir) if \
vier
> Ruere
> Sent: 22 January 2005 16:25
> To: tutor@python.org
> Subject: [Tutor] Re: glob or filter help
>
>
> Jay Loden wrote:
> > Thanks! That's exactly the kind of feedback I was looking for. If
> it's not
> > too much t
Jay Loden wrote:
> Thanks! That's exactly the kind of feedback I was looking for. If
it's not
> too much trouble, do you think you could explain how lambda works, or
just
> point me towards a lambda explanation/tutorial that a new programmer can
> understand? It seems to give you some great power
Javier Ruere wrote:
Jay Loden wrote:
I have the following code in my updates script (gets the five most recent
updated files on my site)
def get_fles(exts, upd_dir):
'''return list of all the files matching any extensions in list exts'''
fle_list = []
for each in exts:
cmd = upd_dir + "*." + ea
Jay Loden wrote:
> I have the following code in my updates script (gets the five most recent
> updated files on my site)
>
> def get_fles(exts, upd_dir):
> '''return list of all the files matching any extensions in list exts'''
> fle_list = []
> for each in exts:
> cmd = upd_dir + "*." + ea