import sqlite3
import nltk
from nltk.tokenize import sent_tokenize, word_tokenize
conn = sqlite3.connect('ACE.db')
c = conn.cursor()
c.execute('SELECT can_answer FROM
Can_Answer')
// rows will have all the records from the can_answer field
rows = c.fetchall()
for row in rows:
print(word_tokenize(row))
试试这个:
这是工作,但当使用c.fetchall它没有工作表演说出TypeError时出错:应为字符串或缓冲区
导入sqlite3
导入nltk 从nltk.标记化导入发送的\u tokenize,单词\u tokenize
conn=sqlite3.connect('ACE数据库') c=连接光标()
c.execute('从can\u answer中选择can\u answer')
行=c.fetchone()
对于行中的行: 打印(行)
打印(单词\u标记化(行))
相关问题 更多 >
编程相关推荐