Python Forum
[Tkinter] field in db as text
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] field in db as text
#5
(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]
rwahdan likes this post
Reply


Messages In This Thread
field in db as text - by rwahdan - Jul-15-2021, 08:25 AM
RE: field in db as text - by GOTO10 - Jul-15-2021, 11:40 AM
RE: field in db as text - by deanhystad - Jul-15-2021, 11:40 AM
RE: field in db as text - by rwahdan - Jul-15-2021, 01:38 PM
RE: field in db as text - by GOTO10 - Jul-15-2021, 01:53 PM
RE: field in db as text - by deanhystad - Jul-15-2021, 02:54 PM
RE: field in db as text - by rwahdan - Jul-16-2021, 07:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Link text field to separate python file SMA 2 3,660 Mar-20-2017, 08:45 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020