Evening, i use the following code to retrieve data from the database in order to edit
os.system('cls')
print("Editing the details")
conn = sqlite3.connect('SADS.db')
cur = conn.cursor()
print " "
choice = raw_input("Does the Customer know their user ID? Y/N : ")
if choice == "N":
number = raw_input("What is their phone number? : ")
cur.execute("SELECT * FROM customers")
while True:
rows = cur.fetchone()
if rows == None:
print "No one found with that record"
break
print rows
raw_input("Press Enter to return to the menu")
os.system('cls')
But when i do it i am returned with the following result :
(u'0001', u'Stack', u'Overflow', u'Confused', u'', u'sqlite', u'PYTH OON', u'07831994131', u'TEST@hotmail.com')
Oh p.s those arent the real details i edited them for my safety :’)
But anyway, how do i remove the u’s before each piece of data?
Many thanks.
The
ujust means that you have a Unicode string, and is not part of the string contents.The
ugets output because you printed the entire tuple as a tuple, not the individual strings.The following code works just fine: