使用Anaconda Spyder、Python 3.8.3、nltk 3.5。代码和输出如下所示:
from nltk.corpus import reuters
cfd = [('gas', word) for word in brown.words(categories='gas')]
print(cfd.tabulate(conditions=['gas'], samples=['gasoline', 'barrels']))
----------------
Output:
gasoline barrels
gas 77 64
None
如何才能从此输出中删除任何内容?
FYI - None is not in output when I use Jupyter notebook as below:
cfd = [('gas', word) for word in brown.words(categories='gas')]
cfd.tabulate(conditions=['gas'], samples=['gasoline', 'barrels']
----------------
Output:
gasoline barrels
gas 77 64
您不需要打印来显示输出。只用
相关问题 更多 >
编程相关推荐