forked from shidanxu/meng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
countNumOccurrences.py
41 lines (31 loc) · 955 Bytes
/
countNumOccurrences.py
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
import utilities
import random_generator
import numpy as np
import os
from sklearn.preprocessing import normalize
import random
import matplotlib.pyplot as plt
import pickle
if __name__ == '__main__':
currentPath = os.getcwd()
oldpath = "../../alllogs/"
files = utilities.get_all_files(oldpath)
current_path = os.path.join(currentPath, oldpath)
count_list = []
for afile in files:
print afile
for individual_files in os.listdir(os.path.join(current_path, afile)):
# print individual_files
with open(os.path.join(os.path.join(current_path, afile), individual_files), 'r') as f:
content = f.readlines()
count = len(content)
# print count
# if count > 300:
# print count, content
# print "\n\n\n"
# raw_input()
count_list.append(count)
print count_list
print sum(count_list) / len(count_list)
print max(count_list), min(count_list)
pickle.dump(count_list, open("numberOccurrence.p", "wb"))