I am reading a file line by line. I use a function to find specified characters in a line.
def find_all(a_str, sub):
start = 0
while True:
start = a_str.find(sub, start)
if start == -1: return
yield start
start += len(sub)
with open("file.txt", 'r', encoding='utf-8') as f:
for line in f:
a = list(find_all(line,"==")
This works fine, it will find "==" but I actually need this to find spaces which are somehow omitted when I use:
a = list(find_all(line," "))
What change do I need to make to find spaces?