문제

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