On Tuesday 03 October 2006 19:50, [EMAIL PROTECTED] wrote: > I found myself writing: > > for f in [i for i in datafiles if '.txt' in i]: > print 'Processing datafile %s' % f > > but I was wishing that I could have instead written: > > for f in in datafiles if '.txt' in f: > print 'Processing datafile %s' % f
What about: import glob for filename in glob.glob('*.txt'): print "Processing file", filename ... Christoph -- http://mail.python.org/mailman/listinfo/python-list