I have this piece of code that should return the value of the password from the db and match it with the password entered. I appended the characters on this line to match the formatting of the result that it printed.
appended_y= "(u'" + y + "'y,)"
it even though the two print out the same value the if statement rejects it and always falls to else, Can anyone point me down the right path?
print "Welcome to the online bookstore login!"
x = raw_input('Please enter your user id. ')
y = raw_input('Please enter your password. ')
appended_y= "(u'" + y + "'y,)"
z = "SELECT password FROM members WHERE userid = %s"
self.cursor.execute(z,(x,))
pw=(self.cursor.fetchone())
if appended_y == pw:
self.member_menu()
else:
print "Incorrect name or password. Aborting connection"
1 Answer 1
Look into the type of pw. It may be a string inside a list or tuple.
answered Dec 3, 2012 at 6:55
vpit3833
7,9812 gold badges27 silver badges25 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default
pw. It may be a string inside a list or tuple.