Reputation: 111
I'm using the below to return the results from a sqlite query in python.
data = str(des.fetchmany()) +','+ str(date.fetchone())
but i'm getting a string with line-breakers and [] or () that i'd like to remove.
[(u"text", u'text', number)],(u'yyyy-mm-dd',)
how can i achieve a cleaner string without those line-breakers,[] and ()?
thanks
Upvotes: 0
Views: 717
Reputation: 2172
That actually isn't a string, it looks like a weird type of list. The [] and () are indicative of a list and a tuple respectively. To make it cleaner, get each string individually, and use stringvariable.decode("UTF-8)
to get rid of that ugly u preceding all of your elements.
Upvotes: 1