OLD | NEW |
---|---|
(Empty) | |
1 import os | |
2 | |
3 FOLDER = "/Users/liangzijie/Desktop/testdemo/lx3/out/" | |
01tonythomas
2017/09/25 19:55:09
We cannot have this going into the program, but I
| |
4 FLAG = "OVERALL" | |
5 | |
6 | |
7 def read_file(filename, pattern): | |
01tonythomas
2017/09/25 19:55:09
minor, but for next time - the function name shoul
| |
8 with open(filename) as f: | |
9 lines = f.readlines() | |
10 for line in lines: | |
11 if pattern in line: | |
12 print(line.strip()) | |
13 | |
14 | |
15 for each_file in os.listdir(FOLDER): | |
16 if each_file.startswith("2017"): | |
17 filename = os.path.join(FOLDER + each_file, "load.ycsb.log") | |
18 if os.path.exists(filename): | |
19 read_file(filename, FLAG) | |
OLD | NEW |