[Solved] Check if Python has written the targeted text


This is an alternative to know if python found the text you are looking for:

import requests
from bs4 import BeautifulSoup

urls = ['https://www.google.com']
for i in range(len(urls)):
    r = requests.get(urls[i])
    soup = BeautifulSoup(r.content, 'lxml')
    items = soup.find_all('p')
    for item in items:
        if "2016 - Privacidad - Condiciones" in item.text:
            print "Python has found the targeted text"

If python doesn’t find the text, you need to use remove() method.

1

solved Check if Python has written the targeted text