i'm connecting my app to sql server and want to convert id which is in int type in str type but it gives error " 'str' object is not callable "
i have tried it in terminal and the program runs successfully but getting error while running main program and type of res[0] is <class 'int'>
def findquestion(str):
resp=""
mydb=mysqlc.connect(host="localhost",user="admin",passwd="admin",database="admin")
mycursor = mydb.cursor()
mycursor.execute("select qid,title from questions where title like %s",("%"+str+"%",))
results = mycursor.fetchall()
mydb.close()
for res in results:
id=str(res[0])
resp+="<a href='/question/"+id+"'>"+res[1]+"</a><br>"
return resp
getting error
File "/opt/web-sites/app.py", line 150, in findquestion
id=str(res[0])
TypeError: 'str' object is not callable
sorry for weak english