Nonalphanumeric list order from os.listdir() in Python -
i utilize python process directories of data. recently, have noticed default order of lists has changed nonsensical. example, if in current directory containing next subdirectories: run01, run02, ... run19, run20, , generate list next command:
dir = os.listdir(os.getcwd()) then list in order:
dir = ['run01', 'run18', 'run14', 'run13', 'run12', 'run11', 'run08', ... ] and on. order used alphanumeric. new order has remained me while now.
what determining (displayed) order of these lists? there sort of rule here? result of setting obliviously changed?
edit: give thanks suggestions everyone, know where/how filesystem determines order? i've determined occurs on macfuse mounted drive.
i think order has way files indexed on filesystem. if want create adhere order can sort list after getting files.
python list directory-listing listdir
No comments:
Post a Comment