I’ve got some code that looks like this:
valid = set()
for string in substrings:
for line in dictionary_words:
if string in line:
valid.add(string)
f.writelines(sorted(valid))
Both dictionary_words and substrings are currently lists.
After the substring is found inside any dictionary_words, it should just go ahead and move onto the next substring.
What is the best way of writing that?
@F.C.: If you use
continueinstead ofbreak, it will run the next iteration of the inner for-loop.