سؤال

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