How is Pythons glob.glob ordered? -
i have written following python code:
#!/usr/bin/python # -*- coding: utf-8 -*- import os, glob path = '/home/my/path' infile in glob.glob( os.path.join(path, '*.png') ): print infile
now this:
/home/my/path/output0352.png /home/my/path/output0005.png /home/my/path/output0137.png /home/my/path/output0202.png /home/my/path/output0023.png /home/my/path/output0048.png /home/my/path/output0069.png /home/my/path/output0246.png /home/my/path/output0071.png /home/my/path/output0402.png /home/my/path/output0230.png /home/my/path/output0182.png /home/my/path/output0121.png /home/my/path/output0104.png /home/my/path/output0219.png /home/my/path/output0226.png /home/my/path/output0215.png /home/my/path/output0266.png /home/my/path/output0347.png /home/my/path/output0295.png /home/my/path/output0131.png /home/my/path/output0208.png /home/my/path/output0194.png
in way ordered?
it might ls -l output:
-rw-r--r-- 1 moose moose 627669 2011-07-17 17:26 output0005.png -rw-r--r-- 1 moose moose 596417 2011-07-17 17:26 output0023.png -rw-r--r-- 1 moose moose 543639 2011-07-17 17:26 output0048.png -rw-r--r-- 1 moose moose 535384 2011-07-17 17:27 output0069.png -rw-r--r-- 1 moose moose 543216 2011-07-17 17:27 output0071.png -rw-r--r-- 1 moose moose 561776 2011-07-17 17:27 output0104.png -rw-r--r-- 1 moose moose 501865 2011-07-17 17:27 output0121.png -rw-r--r-- 1 moose moose 547144 2011-07-17 17:27 output0131.png -rw-r--r-- 1 moose moose 530596 2011-07-17 17:27 output0137.png -rw-r--r-- 1 moose moose 532567 2011-07-17 17:27 output0182.png -rw-r--r-- 1 moose moose 553562 2011-07-17 17:27 output0194.png -rw-r--r-- 1 moose moose 574065 2011-07-17 17:27 output0202.png -rw-r--r-- 1 moose moose 552197 2011-07-17 17:27 output0208.png -rw-r--r-- 1 moose moose 559809 2011-07-17 17:27 output0215.png -rw-r--r-- 1 moose moose 549046 2011-07-17 17:27 output0219.png -rw-r--r-- 1 moose moose 566661 2011-07-17 17:27 output0226.png -rw-r--r-- 1 moose moose 561678 2011-07-17 17:27 output0246.png -rw-r--r-- 1 moose moose 525550 2011-07-17 17:27 output0266.png -rw-r--r-- 1 moose moose 565715 2011-07-17 17:27 output0295.png -rw-r--r-- 1 moose moose 568381 2011-07-17 17:28 output0347.png -rw-r--r-- 1 moose moose 532768 2011-07-17 17:28 output0352.png -rw-r--r-- 1 moose moose 535818 2011-07-17 17:28 output0402.png
it not ordered filename or size.
it not sorted @ , uses order @ entries appear in filesystem, i.e. 1 when using ls -u
. (at least on machine produces same order listing glob
matches).
Comments
Post a Comment