I have a weird problem, and I'm not too sure how to fix it after searching Google/SO found nothing similar.
When I tried to grab query results from the cursor, it gives me a tuple of tuples, except the tuples are strings? Below is the code.
def queryFeeds(db):
sql = """SELECT ngo.n_id, feeds.url FROM ngo
JOIN feeds ON ngo.n_id = feeds.n_id;"""
db.c.execute(sql)
feeds = db.c.fetchall()
return feeds
The print output is here for the feeds variable returned by the function:
feeds[0]
('(277,http://resultsuk.wordpress.com/feed)',)
feeds[0][0]
'(277,http://resultsuk.wordpress.com/feed)'
type(feeds[0][0])
<type 'str'>
feeds[0][0][0:10]
'(277,http:'
The db is just a class that has the database connection, where db.c is the cursor. Thanks in advance. The deleted data are http: // links that SO won't let me post because of my low reputation.
Cheers,
Lucas