I managed to come up with the following code, which will allow me to query a data file twice, simultaneously for different information. but, it doesnt seem to be working. Can anyone spot what I'm doing wrong here?
print('Start')
def getAllTimes(arg1):
task1 = arg1
if task1 == 1:
textfile = open(logfile, 'r')
filetext = textfile.read()
textfile.close()
matchesBegin = beginStr in filetext
matchesEnd = endStr in filetext
return(matchesBegin,matchesEnd)
elif task1 == 2:
AllTimeStamps = [ x.split(' ')[0][1:-1] for x in open(logfile).readlines() ]
AllUniqTimeStamps = set(AllTimeStamps)
return AllUniqTimeStamps
etime = 0
AllTimes = []
for etime in range(1,2):
AllTimeZ = threading.Thread(target=getAllTimes, args=[etime])
AllTimes.append(AllTimeZ)
AllTimeZ.start()
for TheTimes in AllTimes:
TheTimes.join()
print TheTimes
print('Done')
After the above code runs, I want to make sure I can query the content of any variables created in the functions. And by variables I mean: matchesBegin, matchesEnd, AllUniqTimestamps