-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap_counter.py
More file actions
33 lines (23 loc) · 836 Bytes
/
map_counter.py
File metadata and controls
33 lines (23 loc) · 836 Bytes
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
import os
replayList = os.listdir('replays')
#replayList = os.listdir('.')
#replayList.remove('map_counter.py')
for i in range(len(replayList)):
splittedReplayName = replayList[i].split('_')
for l in range(1, len(splittedReplayName)):
if splittedReplayName[-l].isdigit() == True:
temp = "_".join(splittedReplayName[-l:]).replace('.wotreplay', '')
break
replayList[i] = temp
mapCount = dict()
for map in replayList:
mapCount[map] = mapCount.get(map, 0) + 1
#print mapCount
resultList = list()
for m in mapCount:
resultList.append( (mapCount[m], m) )
resultList.sort()
print "Total number of battles is " + str(len(replayList)) + ":"
for i in resultList[::-1]:
print str(i[0]) + ' is count of "' + i[1] + '"'
raw_input("Press Enter.")