python操作数据库fetchall()返回的值为什么匹配不上?

send_id = cur.fetchall()
print send_id
check_id = '(%sL)' % last_id
print check_id
if check_id in send_id:
    print 'success'
else:
    print 'fair'

运行结果:
((7131L,),)
(7131L)
fair

比较迷惑啊。我怎么改格式都是fair。

阅读 4.6k
1 个回答

check_id 是一个字符串 send_id 里面存的是元组
in判断当然会失败

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题