# Open the file
fhand = open('path and the name of the file')
count = 0
# iterate through the lines in the file
for line in fhand:
# Remove the
at the end and stop printing an empty line
line = line.rstrip()
if 'sub string' in line:
count += 1
print(count, line)
# Close the file
fhand.close()