File "D:\pycharm\my_pythonPriject\实例10 文本词频统计.py", line 5
txt = open("C:\Users\YXX的HP\Desktop\hamlet.txt","r").read()
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
进程已结束,退出代码1
你的hamlet.txt是啥编码啊?转个utf8试试?