NameError: name 'raw_input' is not defined

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_inputinput
修改:

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.
发布了44 篇原创文章 · 获赞 0 · 访问量 1309

猜你喜欢

转载自blog.csdn.net/qq_41664688/article/details/104272111