如何在我的python代码中输入阿拉伯语文本?

Man*_*adi 5 python unicode encoding utf-8

我的项目是用阿拉伯语识别积极或消极(情绪分析)的情绪,为了完成这个任务,我使用NLTK和python,当我输入阿拉伯语的推文时发生错误

>>> pos_tweets = [(' ????? ?? ??? ??? ????', 'positive'),
              ('?? ???? ?????? ????????', 'positive'),
              ('???? ??? ?? ??????', 'positive'),
              ('????? ????', 'positive'),
              ('???? ????? ?? ???? ?????????? ???????? ???????????', 'positive')]
Unsupported characters in input
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题?

pra*_*ram 3

您的问题来自 IDLE shell。AFAIK IDLE 在交互模式下不接受 UTF-8 输入。

我建议您使用替代(和更好)的 shell,例如DreamPiePythonWin