Python NLTK: SyntaxError: Non-ASCII character '\xc3' in file (Sentiment Analysis -NLP)

前端 未结 1 1953
日久生厌
日久生厌 2020-12-13 01:48

I am playing around with NLTK to do an assignment on sentiment analysis. I am using Python 2.7. NLTK 3.0 and NumPy1.9.1 version.

This is the code :

         


        
相关标签:
1条回答
  • Add the following to the top of your file # coding=utf-8

    If you go to the link in the error you can seen the reason why:

    Defining the Encoding

    Python will default to ASCII as standard encoding if no other encoding hints are given. To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file, such as: # coding=

    0 讨论(0)
提交回复
热议问题