Created
November 10, 2019 14:49
-
-
Save tsukanov-as/5a77afead466710631eb1ced7f90f39f 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
import pathlib | |
import concurrent.futures | |
def parse(path): | |
cnt = 0 | |
with open(str(path), 'r', encoding='utf-8-sig') as f: | |
for line in f.readlines(): | |
x = line.strip() | |
if x and not x.startswith('//'): | |
cnt += 1 | |
return cnt | |
def main(): | |
mypath = "C:/temp/ERP" | |
result = list(pathlib.Path(mypath).rglob("*.[bB][sS][lL]")) | |
with concurrent.futures.ProcessPoolExecutor() as executor: | |
res = executor.map(parse, result) | |
sum = 0 | |
for x in res: | |
sum += x | |
print(sum) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment