generating list of files matching condition

Seb spluque at gmail.com
Thu Nov 24 15:21:21 EST 2016


On Thu, 24 Nov 2016 10:18:21 +0100,
Peter Otten <__peter__ at web.de> wrote:

> Is win_files huge? Then it might help to avoid going over the entire
> list for every interval. Instead you can sort the list and then add to
> the current list while you are below nextw.

> My pandas doesn't seem to have Timedelta (probably it's too old), so
> here's a generic solution using only the stdlib:

[...]

> PS: If the files' prefixes differ you cannot sort by name. Instead use

> ec_files.sort(key=filename_to_time)

> PPS: There is probably a way to do this by converting the list to a
> pandas dataframe; it might be worthwhile to ask in a specialised
> forum.

Thank you, I learned a few things there (particularly nonlocal, since
I'm still in Python 2.7)!

-- 
Seb




More information about the Python-list mailing list