代码: sql1=f"select People_ID from Account where People_ID = {self.contents3}" cursor.execute(sql1) print(cursor.fetchone()) print(self.contents3) if(self.contents3 in cursor.fetchone()): tkmessage.showwarning(title="warning",message="该身份证号已注册过账号")
报错:
if(self.contents3 in cursor.fetchone()):
TypeError: argument of type 'NoneType' is not iterable
代码中cursor.fetchone()是由输出的数据的且是元组形式,为什么我if语句会报错?
谢谢大佬解惑