In this case there are 3 classes which is represented by the value 0, 1 and 2. I would like to extract information that are belong to class 1 from another text file called fileA.txt. I would like to know how to solve this using python.
For example:
class.txt
0
0
1
2
2
1
1
fileA.txt
a=[1,3,2,1]
b=[3,2]
c=[3,2,1]
d=[3,3]
e=[4,5,6]
f=[3,2,3]
g=[2,2]
Expected output:
c=[3,2,1]
f=[3,2,3]
g=[2,2]
Can anyone help me?
Read the "class.txt" file and create list of classes:
Read the "fileA.txt" file and create list of correct lines:
Show the result: