Concatenating files in order

Grant Edwards grant.b.edwards at gmail.com
Tue May 23 16:24:57 EDT 2017


On 2017-05-23, Mahmood Naderan via Python-list <python-list at python.org> wrote:

> import glob;
> for f in glob.glob('*chunk*'):
>       print(f)
>
> it will print in order. Is that really sorted or it is not guaranteed?

https://docs.python.org/2/library/glob.html
https://docs.python.org/3/library/glob.html

It's in the first sentence:

  The glob module finds all the pathnames matching a specified
  pattern according to the rules used by the Unix shell, although
  **RESULTS ARE RETURNED IN ARBITRARY ORDER**.

[my emphasis]

-- 
Grant Edwards               grant.b.edwards        Yow! Why is everything made
                                  at               of Lycra Spandex?
                              gmail.com            




More information about the Python-list mailing list