I am working on a Machine Learning Project which filters spam/phishing emails out of all emails. For this, I am using the SpamAssassin dataset. The dataset contains different mails in this format: For identifying phishing emails, first thing I have to do is finding out how many web-links the email has. For doing that, I have written the following code: