title: Object of type 'NoneType' has no len() error
body: <p>What I want is to count the occurrence of a specific word on goole first page result site, and then once again count for another word - if this word appears more than 2 times, then I will change the occurrence of the first word to 0. But I get this error:</p>
  
  <p>File "D:\HQ_Bot-master\answer_bot.py", line 307, in 
      get_points_live()</p>
  
  <p>File "D:\HQ_Bot-master\answer_bot.py", line 293, in get_points_live
      points,maxo = google_wiki(simq, options, neg)</p>
  
  <p>File "D:\HQ_Bot-master\answer_bot.py", line 242, in google_wiki
      count2 = len(words2)</p>
  
  <p>TypeError: object of type 'NoneType' has no len()</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import string
  import requests 
  import json
  import urllib.request as urllib2
  from bs4 import BeautifulSoup
  from google import google
  from PIL import Image
  import pytesseract
  import argparse
  import cv2
  import os
  import pyscreenshot as Imagegrab
  import sys
  import wx
  from halo import Halo
  
  def google_wiki(sim_ques, options, neg):
          spinner = Halo(text='Googling and searching Wikipedia', spinner='dots2')
          spinner.start()
          num_pages = 1
          points = list()
          content = ""
          maxo=""
          maxp=-sys.maxsize
          i = 0
          temp = 0
          ques = ""
          translator = str.maketrans(string.punctuation, ' '*len(string.punctuation))
          sim_ques22 = sim_ques.translate(translator)
          while i &lt; 3:
                  o = options[i]
                  if i &lt;= 1:
                          x = options[i+1]
                  else:
  
                          x = options[i-1]
  
                  o = o.lower()
                  x = x.lower()
  
                  ques += sim_ques22 + ' ' + o + ' wiki'
                  print(ques)
                  page = requests.get("http://www.google.com/search?q="+ques)
                  soup = BeautifulSoup(page.text,"lxml")
                  words = soup.find(text=lambda text: text and o in text)
                  if(type(words)is not None):
                      count = len(words)
  
  
                  words2 = soup.find(text=lambda text: text and x in text)
                  if(type(words)is not None):
                          count2 = len(words2)
  
                  if count2 &gt;= 2:
                          temp = 0
                  else:
                          temp = count
  
                  if neg:
                          temp*=-1
                  points.append(temp)     
                  if temp&gt;maxp:
                          maxp=temp
                          maxo=o
                  ques = ""        
                  i += 1
  
  
          spinner.succeed()
          spinner.stop()
          return points,maxo
  
  </code></pre>