@jasonharper is right. In addition to what he said, if you want to get the row numbers, you should make something like this:
import os
import re
finalListFileTxt = 'teste.txt'
searchedIndexValue = []
with open(finalListFileTxt,"r") as arq:
for i,linha in enumerate(arq.readlines()):
pattern = r'^01'
if re.findall(pattern,linha):
searchedIndexValue.append(i)
print(searchedIndexValue)
enumerate will iterate arq.readlines() and return a pair of linenumber and line.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…