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

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top