【发布时间】:2017-07-23 10:04:37
【问题描述】:
在 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']
如果有任何可能的方式来获得我想要的输出。请帮帮我!
【问题讨论】: