title: python mysql fetch query
body: <pre><code>def dispcar ( self, reg ):
                  print ("The car information for '%s' is: "), (reg)
                  numrows = int(self.dbc.rowcount) #get the count of total rows
                  self.dbc.execute("select * from car where reg='%s'") %(reg)
                  for x in range(0, numrows):
                      car_info = self.dbc.fetchone()
                      print row[0], "--&gt;", row[1]
  </code></pre>
  
  <p>the above code gives this error:</p>
  
  <pre><code>self.dbc.execute("select * from car where reg='%s' " %(reg)
  TypeError: unsupported operand type(s) for %: 'long' and 'str'
  </code></pre>
  
  <p>can anyone please help me understand why am i getting this error?</p>
  
  <p>FYI: reg is a raw_input var i input from user in the function getitem and pass the reg var as an argument to this function.</p>