7得票2回答
为什么Python中的'for word in words:'循环遍历的是单个字符而不是单词?

当我在一个字符串words上运行以下代码时: def word_feats(words): return dict([(word, True) for word in words]) print(word_feats("I love this sandwich.")) 我得到的输...