使用 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
如何从此输出中删除 None ?
仅供参考 - 当我使用 Jupyter 笔记本时,没有输出如下:
cfd = [('gas', word) for word in brown.words(categories='gas')]
cfd.tabulate(conditions=['gas'], samples=['gasoline', 'barrels']
----------------
Output:
gasoline barrels
gas 77 64