我想在一个字符串列表中找到整个单词的数目,这是列表
mylist = ["Mahon Point retail park", "Finglas","Blackpool Mahon", "mahon point blanchardstown"]
预期结果:
4
1
2
3
mylist[0]中有4个单词,mylist[1]中有1个单词,依此类推
for x, word in enumerate(mylist):
for i, subwords in enumerate(word):
print i
完全不起作用。。。。
你们觉得呢?
Tags:
最简单的方法应该是
使用
str.split
:您可以使用NLTK:
输出:
相关问题 更多 >
编程相关推荐