sort by file/directory

Mike Zupan mzupan at
Wed Sep 10 20:42:24 CEST 2003

I have a list that includes files and directories

ie: list = ['file', 'file2', 'dir1','file3','dir2' ]

I want to sort it so it looks like this

['dir1', 'dir2', 'file1','file2','file3' ]

I'm just wondering if there is an easy way to do this


More information about the Python-list mailing list