Here I'm basically trying to fetch a string value from the SQL Table and I want to compare that value with the string I entered. I tried this simple way but unfortunately, it isn't working. I need help.
def cantkt():
#tkt()
#canstate=("DELETE FROM Chart WHERE PNR=%s"%canpnr)
canpnr=input("Enter PNR No. to Cancel Ticket: ")
mycsr.execute("SELECT PNR FROM Chart WHERE PNR=%s"%canpnr)
res=mycsr.fetchone()
print(res)
if res==canpnr:
print("PNR MATCHED")
else:
print("PNR No. DOES NOT MATCH")
print(res)and thenprint(canpnr)It would have made it really plain for you why they didn't match :)('1019654419',)and the other would print1019654419.