11

I want to check if the From header contains the email address [email protected]:

if msg['From'] =='[email protected]': count+=1 

This does not add one to the count because the header actually contains 'YouTube [email protected]'.

How can I adapt my code so it adds one to the counter, checking that it contains '[email protected]' anywhere in the header?

0

1 Answer 1

8

Try using in.

>>> "[email protected]" in '[email protected]' True 
Sign up to request clarification or add additional context in comments.

Comments