Read special characters from .txt file in python

前端 未结 3 499
滥情空心
滥情空心 2021-01-19 21:56

The goal of this code is to find the frequency of words used in a book.

I am tying to read in the text of a book but the following line keeps throwing my code off:

3条回答
  •  攒了一身酷
    2021-01-19 22:26

    The best way I could think of is to read each character as an ASCII value, into an array, and then take the char value. For example, 97 is ASCII for "a" and if you do char(97) it will output "a". Check out some online ASCII tables that provide values for special characters also.

提交回复
热议问题