Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql return values padded with " (' " and " '), " ?

Status
Not open for further replies.

j2ecoder

Programmer
Jan 2, 2006
5
PH
Hello,

When the select statement contains only one column, the returned values contains "(' " and " ')," as prefix and suffix. Why? See my code below.

import kinterbasdb
# conect blah blah
cur = con.cursor()
cur.execute("select last_name from employee where emp_no < 50")
for (last_name) in cur:
print last_name

While this one runs perfectly as expected. (I added emp_no here)

cur = con.cursor()
cur.execute("select emp_no, last_name from employee where emp_no < 50")
for (emp_no, last_name) in cur:
print last_name

Thanks for any hints.
 
try
Code:
for (last_name,) in cur:
    print last_name
note the comma before the )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top