title: How to print '%d' & '%s' in a class in python
body: <p>I'm writing a script which counts some specific words and gives me specific count of the words. </p>
  
  <p>I'm currently stuck in printing data, from the class. </p>
  
  <p>My next task would be put these values in a excel file using a data driven framework. </p>
  
  <p>Here's what i have done until now:</p>
  
  <pre><code>a = driver.page_source
  soup = BeautifulSoup(a, "html.parser")
  
  
  class counter_class:
      def count(self, tittle, block_code):
          blockcode_passed = block_code.count("Passed")
          blockcode_blocked = block_code.count("Blocked")
          blockcode_fail = block_code.count("Failed")
          blockcode_retest = block_code.count("Retest")
          blockcode_cannot_test = block_code.count("Connot Test")
          blockcode_completed = block_code.count("Completed")
          blockcode_passwc = block_code.count("Pass With Concern")
          blockcode_untested = block_code.count("Untested")
  
          print '%s' + ' ' + '%d' %(tittle,blockcode_passed)
          print '%s' + ' ' + '%d' %(tittle,blockcode_fail)
          print "Apps Gateway(Untested)" + ' ' + '%d' %(blockcode_untested)
          print "Apps Gateway(Blocked)" + ' ' + '%d' %(blockcode_blocked)
          print "Apps Gateway(Retest)" + ' ' + '%d' %(blockcode_retest)
          print "Apps Gateway(Cannot Test)" + ' ' + '%d' %(blockcode_cannot_test)
          print "Apps Gateway(Completed)" + ' ' + '%d' %(blockcode_completed)
          print "Apps Gateway(Pass With Concern)" + ' ' + '%d' %(blockcode_passwc)
  
  
  
  
  apps_gateway = soup.find_all("div", {"id":"group-3191427"})
  apps_gateway_str = str(apps_gateway)
  apps_gateway_obj=counter_class()
  apps_gateway_obj.count("appsgateway",apps_gateway_str)
  </code></pre>
  
  <p>The second part of the code works but the 1st part of the code:</p>
  
  <pre><code>print '%s' + ' ' + '%d' %(tittle,blockcode_passed)
  print '%s' + ' ' + '%d' %(tittle,blockcode_fail)
  </code></pre>
  
  <p>Gives me error: </p>
  
  <pre><code>print '%s' + ' ' + '%d' %(tittle,blockcode_passed)
  TypeError: %d format: a number is required, not str
  </code></pre>