I have the following data in a text file.
[Test id_g001,**Test id_g002,Test id_g000, Value_is_0, Value_is_2, Value_is_1]
I can only sort the data. How do you sort the data in parallel, so the data will be sorted as follows? Both of the Test ID and Value needs to be sorted
Test ID ---------------Value
g000 ------------------- 0
g001 ------------------- 1
g002 ------------------- 2
The code is:
def readFile():
from queue import PriorityQueue
q = PriorityQueue()
#try block will execute if the text file is found
try:
fileName= open("textFile.txt",'r')
for line in fileName:
for string in line.strip().split(','):
q.put(string[-4:])
fileName.close() #close the file after reading
print("Displaying Sorted Data")
while not q.empty():
print(q.get())
#catch block will execute if no text file is found
except IOError:
print("Error: FileNotFoundException")
return