Python (nltk) - UnicodeDecodeError: 'ascii' codec can't decode byte

前端 未结 4 1967
轻奢々
轻奢々 2020-12-06 12:10

I\'m new to NLTK. I\'m getting this error and I\'ve searched around for encoding/decoding and specifically the UnicodeDecodeError but this error seems specific to the NLTK s

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-06 12:35

    try this... NLTK 3.0.1 with Python 2.7.x

    import io
    f = io.open(txtFile, 'rU', encoding='utf-8')
    

提交回复
热议问题