-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadfile.py
More file actions
69 lines (63 loc) · 1.73 KB
/
Copy pathreadfile.py
File metadata and controls
69 lines (63 loc) · 1.73 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
def read(file_name):
txt = open(file_name,'r', encoding='latin-1')
out=txt.read()
length=len(out)
string_list=[]
frequency=""
for i in range(length):
k=out.find("frequency")
k+= (len("frequency")+2)
for j in range(k, length):
if out[j]=='\"':
for m in range(j+1,length):
frequency += out[m]
if out[m+1]=='\"':
break
break
break
print(frequency)
for i in range(length):
k=out.find("close_eye")
k+=(len("close_eye")+2)
for j in range(k, length):
if out[j]=='\"':
close=out[j+1]
break
break
string_list.append(close)
print(close)
for i in range(length):
k=out.find("yawn")
k+=(len("yawn")+2)
for j in range(k, length):
if out[j]=='\"':
yawn=out[j+1]
break
break
string_list.append(yawn)
print(yawn)
for i in range(length):
k=out.find("posture")
k+=(len("posture")+2)
for j in range(k, length):
if out[j]=='\"':
posture=out[j+1]
break
break
string_list.append(posture)
print(posture)
for i in range(length):
k=out.find("unknown")
k+=(len("unknown")+2)
for j in range(k, length):
if out[j]=='\"':
unknown=out[j+1]
break
break
string_list.append(unknown)
print(unknown)
txt.close()
return string_list
# Main method.
if __name__ == '__main__':
read("temp.txt")