Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liang4793 committed Jul 5, 2022
1 parent b96ce49 commit 921a3be
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Emergency-Brakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ def brake_service(service_name):

'''about log'''
def write_log(device):
log = open('log.txt', 'a')
log = open('.\log.txt', 'a')
time = datetime.datetime.now()
log.writelines("[" + str(time) + "] " + str(device) +
" detected being used." + "\n")
log.close()

def read_log(l):
log = open("log.txt", "r+")
log = open(".\log.txt", "r+")
line = log.read().splitlines()
list1 = line[int(l)-1:int(l)]
result = ''.join(list1)
Expand All @@ -92,10 +92,10 @@ def window_thread():
'''rewrite log'''
def rewrite_log_loger(value):
def changeline(line, content):
log = open('log.txt', 'r+')
log = open('.\log.txt', 'r+')
flist = log.readlines()
flist[int(line)] = str(content) + "\n"
log = open('log.txt', 'w+')
log = open('.\log.txt', 'w+')
log.writelines(flist)
log.close()
if value == "1":
Expand All @@ -107,10 +107,10 @@ def changeline(line, content):

def rewrite_log_toaster(value):
def changeline(line, content):
log = open('log.txt', 'r+')
log = open('.\log.txt', 'r+')
flist = log.readlines()
flist[int(line)] = str(content) + "\n"
log = open('log.txt', 'w+')
log = open('.\log.txt', 'w+')
log.writelines(flist)
log.close()
if value == "1":
Expand All @@ -122,10 +122,10 @@ def changeline(line, content):

def rewrite_log_brake(value):
def changeline(line, content):
log = open('log.txt', 'r+')
log = open('.\log.txt', 'r+')
flist = log.readlines()
flist[int(line)] = str(content) + "\n"
log = open('log.txt', 'w+')
log = open('.\log.txt', 'w+')
log.writelines(flist)
log.close()
if value == "1":
Expand Down

0 comments on commit 921a3be

Please sign in to comment.