-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgolist.py
More file actions
executable file
·50 lines (40 loc) · 1.24 KB
/
Copy pathalgolist.py
File metadata and controls
executable file
·50 lines (40 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/local/bin/python3
from os import listdir
from os import walk
import re
path = 'algo'
fileList = []
dirList = []
filtered = []
def appendFiles(path, dirList, fileList):
for (dirpath, dirnames, filenames) in walk(path):
fileList.extend(filenames)
dirList.extend(dirnames)
break
def filteredFiles(path, dirList, fileList, filtered):
appendFiles(path, dirList, fileList)
# print("File List:", fileList)
# print("Dir List :", dirList)
for d in dirList:
appendFiles(path+"/"+d, [], fileList)
for f in fileList:
found = re.search("_{2}\d+_{2}.+\.py", f)
if found:
filtered.append(found.string)
def getPracticeNumber():
return len(filtered)
def showQuizListFromDir():
filteredFiles(path, dirList, fileList, filtered)
filtered.sort()
print()
print("=====================================")
print("============= Local Repo ============")
print("=====================================")
for e in filtered:
print(e)
print("=====================================")
print("Num of Python Practice: ", getPracticeNumber())
print()
# run as a script (not module)
if __name__ == '__main__':
showQuizListFromDir()