This commit is contained in:
AFCMS 2021-04-27 19:16:08 +02:00
parent 72e53a82d7
commit 0a2fcdc4e8

View File

@ -2,17 +2,25 @@ import os
import re import re
from pathlib import Path from pathlib import Path
path = "../mods/" path = "./mods/"
pattern = re.compile(r'[a-z]') # pattern = re.compile(r'^(?P<nomtableau>[^ \t\]]+)[ ]*=[ ]*\{')
pattern = re.compile(r'^(?P<nomtableau>[^ \t\]]+)[ ]*=[ ]*\{')
pathlist = Path(path).rglob('*.lua') pathlist = Path(path).rglob('*.lua')
for path in pathlist: for path in pathlist:
path_in_str = str(path) path_in_str = str(path)
print(path_in_str) # print(path_in_str)
trouve = False
with open(path_in_str) as f: with open(path_in_str) as f:
for line in f: for i, line in enumerate(f.readlines()):
if pattern.search(line): m = pattern.match(line)
print(line) if m:
print(path_in_str, ":", i+1, ":", m.group('nomtableau').strip())
trouve = True
break
if not trouve:
print(path_in_str, ": -")
for subdir, dirs, files in os.walk(path): for subdir, dirs, files in os.walk(path):
for file in files: for file in files: