Python 自然语言处理 P93
s = raw_input("Enter some text: ")
Traceback (most recent call last):
File "<ipython-input-65-b20798fb1c8b>", line 1, in <module>
s = raw_input("Enter some text: ")
NameError: name 'raw_input' is not defined
Python 3合并了 raw_input
和 input
修改:
s = input("Enter some text: ")
Enter some text: On an exceptional hot evening
print ("You typed", len(nltk.word_tokenize(s)), "words.")
You typed 5 words.