Created
September 26, 2019 07:46
-
-
Save sagorbrur/d9d7354a488daf22861f9c319b1bf720 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# glob list has a sorting problem. this scrip will solve this issue. | |
import glob | |
files = glob.glob('test/*.txt') | |
files.sort(key=lambda var:[int(x) if x.isdigit() else x for x in re.findall(r'[^0-9]|[0-9]+', var)]) | |
for file in files: | |
print(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment