title: How to scrape data from table using CSS Selector and BeautifulSoup?
body: <p>On this page, there is a series of tables I'm trying to get specific data from an unnamed table and unnamed cells. I used Copy Selector from the inspect elements in Chrome to find the CSS selector. When I'm asking Python to print that specific CSS Selector, i'm getting 'Nonetype' object is not callable</p>
  
  <p>Specifically on this page, I am trying to get the number "198" to show up from the table in #general-info, article:nth-child(4), table:nth-child(2), </p>
  
  <p>The CSS Selector path is :</p>
  
  <pre><code>"html body div#program-details section#general-info article.grid-50 table tbody tr td"
  </code></pre>
  
  <p>and this comes up using the Copy Selector</p>
  
  <pre><code>#general-info &gt; article:nth-child(4) &gt; table:nth-child(2) &gt; tbody &gt; tr &gt; td:nth-child(2)
  </code></pre>
  
  <p>Most of the code is accessing the site and bypassing the EULA. Skip to the bottom for the code i'm having problems with.</p>
  
  <pre><code>import mechanize  
  import requests
  import urllib2
  import urllib
  import csv
  from BeautifulSoup import BeautifulSoup
  
  br = mechanize.Browser()
  br.set_handle_robots(False)
  br.addheaders = [("User-agent","Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13")]
  
  sign_in = br.open('https://login.ama-assn.org/account/login')  #the login url
  
  br.select_form(name = "go") #Alternatively you may use this instead of the above line if your form has name attribute available.
  
  br["username"] = "wasabinoodlz" #the key "username" is the variable that takes the username/email value
  br["password"] = "Bongshop10"    #the key "password" is the variable that takes the password value
  logged_in = br.submit()   #submitting the login credentials
  logincheck = logged_in.read()  #reading the page body that is redirected after successful login
  #print (logincheck) #printing the body of the redirected url after login
  
  
  # EULA agreement stuff
  cont = br.open('https://freida.ama-assn.org/Freida/eula.do').read()
  cont1 = br.open('https://freida.ama-assn.org/Freida/eulaSubmit.do').read()
  
  # Begin request for page data
  req = br.open('https://freida.ama-assn.org/Freida/user/programDetails.do?pgmNumber=1205712369').read()
  
  #Da Soups!
  soup = BeautifulSoup(req)
  #print soup.prettify() # use this to read html.prettify()
  
  
  for score in soup.select('#general-info &gt; article:nth-child(4) &gt; table:nth-child(2) &gt; tbody &gt; tr &gt; td:nth-child(2)'):
      print score.string
  </code></pre>