I'm seeing different behaviour between code that looks to be the same. It obviously isn't the same, so I've misunderstood something:
>>> log_names ('access', 'varnish') >>> log_dates ('20091105', '20091106') >>> logs = itertools.chain.from_iterable(glob.glob('%sded*/%s*%s.gz' % >>> (source_dir, log, date)) for log in log_names for date in log_dates) >>> for log in logs: ... print log ... /Volumes/UNTITLED 1/ded1/access_log-20091105.gz /Volumes/UNTITLED 1/ded2/access_log-20091105.gz /Volumes/UNTITLED 1/ded3/access_log-20091105.gz /Volumes/UNTITLED 1/ded1/access_log-20091106.gz /Volumes/UNTITLED 1/ded2/access_log-20091106.gz /Volumes/UNTITLED 1/ded3/access_log-20091106.gz /Volumes/UNTITLED 1/ded1/varnishncsa.log-20091105.gz /Volumes/UNTITLED 1/ded2/varnishncsa.log-20091105.gz /Volumes/UNTITLED 1/ded3/varnishncsa.log-20091105.gz /Volumes/UNTITLED 1/ded1/varnishncsa.log-20091106.gz /Volumes/UNTITLED 1/ded2/varnishncsa.log-20091106.gz /Volumes/UNTITLED 1/ded3/varnishncsa.log-20091106.gz However: for date in log_dates: for log in log_names: logs = itertools.chain.from_iterable(glob.glob('%sded*/%s*%s.gz' % (source_dir, log, date))) Gives me one character at a time when I iterate over logs. Why is this? And how, then, can I make the first more readable? S. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor