我想使用Python MySql数据库更新表的值,但得到此错误。 TypeError: query() argument 1 must be a string or read-only buffer, not tuple
。 我无能为力,我的答案出了什么问题。TypeError:查询()参数1必须是字符串或只读缓冲区,而不是元组
def id_of_unverifedUniversity():
cur3.execute('select id from universities where verified=0 and deleted=0;')
print "===================Unverififed University================"
for row in cur3.fetchall():
#cur3.execute('SELECT id FROM Users where universityId='+str(row['id']))
print row['id']
query = ('SELECT id FROM users where universityId = %s order by id asc limit 1' %(str(row['id'])))
cur3.execute(query)
result = cur3.fetchall()
for y in result:
if y['id']:
print str(y['id'])
print 'update query statred'
query1 = ("""update universities set updatedBy = %s where id=%s""", (str(y['id']),str(row['id'])))
cur3.execute(query1)
我在QUERY1
得到错误,查询工作正常 –
@Abi Waqas似乎''%运营商在'query1'错过,看到它的更新回答 – Rajez