import os
result = os.listdir('.')
result.sort()
print result
But it feels like it’s not meaningful to ask for the same order as the resource manager. Because the list in the resource manager may be in order of modification time, name, or some other unknown order..
Sort by modification time, you can adjust it yourself
import os
result = [(i, os.stat(i).st_mtime) for i in os.listdir('.')]
for i in sorted(result, key=lambda x: x[1]):
print i[0]
Let’s try it in order...
But it feels like it’s not meaningful to ask for the same order as the resource manager. Because the list in the resource manager may be in order of modification time, name, or some other unknown order..
Sort by modification time, you can adjust it yourself