I'm writing a script where by a user registers his/her username, but a function checks whether this username is already in the db or not. But I'm stuck on how to match my query with the input. Here is the code:
def checker(self, insane):
t = (insane,)
cmd = "SELECT admin_user FROM admin_db where admin_user = \"%s\";" %t
self.cursor.execute(cmd)
namer = self.cursor.fetchone()
print namer
if namer == insane:
print("Username is already chosen!")
exit(1)
else:
pass
Since
namerreturns as
(u'maverick',)It doesn't match with the input. How should I go about implementing that?