title: Python 3.6 NameError: name 'x' is not defined
body: <p>I am new to python. I am getting a NameEror when I run this code. I am not using any kind of input() or variable type selection etc.</p>
  
  <p>I had run the same scrip the previous night without any problems! </p>
  
  <pre><code>import csv
  from bs4 import BeautifulSoup
  import requests
  
  
  with open('URLs.csv') as csvfile:
      reader = csv.DictReader(csvfile)
      for row in reader:
          url = row ['URL']
          r  = requests.get(url)
  
          data = r.text
  
          soup = BeautifulSoup(data,"lxml")
  
          td = soup.find_all('td', {'class' : 'C($gray) Ta(end)'}) 
          datalist = td
          #x = None        
          for link in datalist[::-1]:
              x = (link.find_all('span')[0])
          print(x.text, ",",row['Ticker'])
  </code></pre>