with open('Bmxxf.txt', encoding="utf8") as f: inp = f.read() with open('lck.txt',encoding="utf8") as fi: inp1 = fi.read() with open('xsfh.txt', encoding="utf8") as fil: inp2 = fil.read() with open('yyd.txt', encoding="utf8") as filee: inp3 = filee.read() with open('ynj.txt', encoding="utf8") as fileee: inp4 = fileee.read() print('Bmxxf has ' + str(inp.count('我')) + " 我 in it")
Hi, Can any one help me with this? I am trying to count the number of "我‘’ in the five articles(Bmxxf.txt, lck.txt, xsfh.txt, yyd.txt, ynj.txt). However after writing the first line to count the number of 我 in Bmxxf.txt. The program keeps showing me this:
File “Jing_Yong_novel_finder.py”, line 16
SyntaxError: Non-UTF-8 code starting with ‘\xce’ in file Jing_Yong_novel_finder.py on line 16, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Does anyone know how to solve it?