Re: [Tutor] Re: glob or filter help

2005-01-24 Thread Jeff Shannon
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 \

RE: [Tutor] Re: glob or filter help

2005-01-22 Thread Barnaby Scott
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

[Tutor] Re: glob or filter help

2005-01-22 Thread Javier Ruere
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

Re: [Tutor] Re: glob or filter help

2005-01-22 Thread Kent Johnson
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

[Tutor] Re: glob or filter help

2005-01-21 Thread Javier Ruere
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