【发布时间】:2020-01-22 22:44:12
【问题描述】:
import nltk
from urllib import request
url = "http://www.site.uottawa.ca/~diana/csi5386/A1_2020/microblog2011.txt"
response = request.urlopen(url)
raw = response.read().decode('utf8')
tokens = nltk.word_tokenize(raw)
tokens
在上面的代码中,输出是列表形式的'tokens'。如何将此列表复制到文本文件中?
【问题讨论】:
-
这能回答你的问题吗? Python 2.7: Print to File
标签: python-3.x nlp