-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreviewlist.py
More file actions
executable file
·53 lines (43 loc) · 1.38 KB
/
Copy pathreviewlist.py
File metadata and controls
executable file
·53 lines (43 loc) · 1.38 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
49
50
51
#!/usr/local/bin/python3
from os import listdir
from os import walk
import re
path = 'review'
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("_{1}\d+_{1}.+\.py", f)
if found:
filtered.append(found.string)
def getReviewNumber():
#If we don't call the showQuiz in the main program, we need to do this
filteredFiles(path, dirList, fileList, filtered)
return len(filtered)
def showQuizListFromDir():
filteredFiles(path, dirList, fileList, filtered)
filtered.sort()
print()
print("=====================================")
print("=============== Review ==============")
print("=====================================")
for e in filtered:
print(e)
print("=====================================")
print("Num of Review: ", getReviewNumber())
print()
# run as a script (not module)
if __name__ == '__main__':
#print(getReviewNumber())
showQuizListFromDir()