Here's a sample code
with open('somefile.txt', 'r') as file:
for line in file:
find = 'some string'
if find in line:
if previous line is the same as this line: #how to write this ?
pass
else:
print(line)
How to write line 5 in this code ?