<分区> 分区>
在 python 中,我从数据库中获取所有数据。
SENTENCE = "It is wonderful. I'am happy"
sent= (word_tokenize(SENTENCE))
cursor = conn.cursor()
format_strings = ','.join(['%s'] * len(sent))
cursor.execute("SELECT emotion_type FROM emotion WHERE key_word IN (%s)" % format_strings,tuple(sent))
results = cursor.fetchall()
for i in results:
z= (i)
输出是
('happy',)
('happy',)
但我想得到这样的结果
['happy','happy']
如果有任何可能的方法可以得到我想要的输出。请帮助我!
