Jul-15-2021, 01:53 PM
(Jul-15-2021, 01:38 PM)rwahdan Wrote:(Jul-15-2021, 11:40 AM)deanhystad Wrote: Really? You are asking how to get an item from a tuple?No I am getting the value from database and its data type is text. My question is why it is printed as tuple and not as text??
The fetchall() method returns a list of tuples. Your assignment on line 6 assigns the variable to the first value in the list, which is a tuple. You need to go another layer deep and pull the string from the tuple if that's what you are looking for:
theanswer=records[0][0]