On 2017-05-23 21:16, Mahmood Naderan via Python-list wrote:
Yup. Make a list of all the file names, write a key function that
extracts the numbery bits, sort the list based on that key function, and
go to town.
Alternatively, when you create the files in the first place, make sure
to use more leading zeros than you could possibly need.
xxx_chunk_000001 sorts less than xxx_chunk_000010.
So, if I write
import glob;
for f in glob.glob('*chunk*'):
print(f)
it will print in order. Is that really sorted or it is not guaranteed?
They are sorted on Windows, but not on Linux. (And even when they _are_
sorted, they might not be stored the way _you_ want them to be!)
It's best to assume that they aren't sorted.
--
https://mail.python.org/mailman/listinfo/python-list