# coding: utf-8
station = open("stations.txt", "r", encoding = "utf-8")
for line in station:
name = line.strip().split(" - ")
print(name)
station.close()
如果我构建它,它会显示如下错误消息
追踪(最近一次呼叫最后一次):
文件 " /路径/ \ u1105 \ u1175 \ u1109 \ u1173 \ u1110 \ u1173 \ u1103 \ u1171 \ u110c \ u1175 \ u11b8 \ u1100 \ u1175(\ u110c \ u1162 \ u1100 \ u1171 \ u110c \ u1165 \ u11a8)。 PY&#34 ;, 7号线,在 打印(名称)
UnicodeEncodeError:' ascii'编解码器无法对字符进行编码 2-4:序数不在范围内(128)
[退出代码1完成0.1秒]
[CMD: [' /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5' ;, ' -u',' /path/name.py']]
[dir:/ path /]
[路径:/ usr / bin:/ bin:/ usr / sbin:/ sbin]
连续三天,我无能为力。请帮帮我