蟒蛇。我想在以下程序中找出错误

时间:2015-09-01 12:26:54

标签: python nltk tokenize

import nltk
from nltk.tokenize import sent_tokenize, word_tokenize
sentence = """At eight o'clock on Thursday morning
                Arthur didn't feel very good."""
a=word_tokenize(sentence)
if a[3] == 'on'
    print a

1 个答案:

答案 0 :(得分:2)

语法错误,您在if条件后忘记了冒号:

if a[3] == 'on':
    print a

我得到了这个输出:

['At', 'eight', "o'clock", 'on', 'Thursday', 'morning', 'Arthur', 'did', "n't", 'feel', 'very', 'good', '.']