Browse Source

os.scandir: Support Python 3.4 via scandir lib

master
Jakub Valenta 3 years ago
parent
commit
3df206cf3b
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      art_strategies.py

+ 6
- 2
art_strategies.py View File

@@ -1,7 +1,11 @@
#!/usr/bin/env python

import datetime
import os
import os.path
try:
from os import scandir
except ImportError:
from scandir import scandir
import shutil

import yaml
@@ -21,7 +25,7 @@ def main():
TEXTS_EXT = '.yml'

files = []
for entry in sorted(os.scandir(PATH_TEXTS), key=lambda x: x.name):
for entry in sorted(scandir(PATH_TEXTS), key=lambda x: x.name):
if not entry.name.startswith('.') and entry.is_file()\
and entry.name.endswith(TEXTS_EXT):
files.append((

Loading…
Cancel
Save