-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplitwebsites.py
More file actions
56 lines (43 loc) · 1.28 KB
/
Copy pathsplitwebsites.py
File metadata and controls
56 lines (43 loc) · 1.28 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
52
53
54
import matplotlib.pyplot as plt
import os
def splitRunFile(dataFile):
dataFile = open(dataFile, "r")
dataLines = dataFile.readlines()
for line in dataLines:
line = line.strip("\n")
line = line.split("; ")
protocol = line[0]
website = line[1]
rtt = line[2]
website = website.strip("http://")
path = "./websites/"+website+"/"
print(protocol)
print(website)
print(rtt)
if not os.path.exists(path):
os.makedirs(path)
filepath = path + protocol + ".txt"
file = open(filepath, "a")
file.write(rtt + "\n")
file.close()
def getAverages(dataFile):
dataFile = open(dataFile, "r")
dataLines = dataFile.readlines()
for line in dataLines:
line = line.strip("\n")
line = line.split("; ")
protocol = line[0]
website = line[1]
rtt = line[2]
website = website.strip("http://")
path = "./websites/average/"
print(protocol)
print(website)
print(rtt)
if not os.path.exists(path):
os.makedirs(path)
filepath = path + "average.txt"
file = open(filepath, "a")
file.write(rtt + "\n")
file.close()
# splitRunFile("run1.txt")