我正在尝试查看用户输入的内容是否与我从php数据库检索的字符串匹配。我已经检索了数据,并且可以使用print(i [random])打印它,但是当我尝试将用户的输入与englishWord = input(“ type answer”,i [random])语句进行比较时,出现此错误TypeError:“ str”对象不可调用
conn = pymysql.connect(host="myhost",user="myname",password="mypassword",db="mydb")
myCursor = conn.cursor()
query = """SELECT russianWord, englishWord FROM words WHERE wordID = 1;"""
myCursor.execute(query)
records = myCursor.fetchall()
random = randint(0,1)
for i in records:
if random == 0:
englishWord = input("type answer", i[random])
else:
russianWord = input("type ander", i[random])