[Solved] reading files in python using minimum lines of code


print("\n".join([i if i != p.sub("", i) else "%fix_me%" for i in open("tt.txt").readlines()]).replace("%fix_me%\n", "")

Updated to reflect comments on comprehension mistake..:

print("\n".join([i for i in open("tt.txt").readlines() if i != p.sub("", i)]))

2

solved reading files in python using minimum lines of code