tuple indices must be integers or slices, not str报错原因及解决方法
elif not user['password'] == password:
TypeError: tuple indices must be integers or slices, not str
这里的意思是元组索引应该是整数,类似user[0]
,user[1]
,而不应该是字符串,字典才可以用字符串进行索引,所以把user['password']
里面的'password'
换成整数或者将元组转换为字典就可以解决此问题。