2025年pycharm编码设置为utf-8._python字符编码使用ascii编码对么

pycharm编码设置为utf-8._python字符编码使用ascii编码对么我试着读入两个文本文件 一个用 UTF8 编码 我在 PyCharm 中使用 python3 在 两个文件中的示例 1 its group are in Spain its group are in Antarctica 2 sus grupos estan en Espa a sus grupos estan en Ant rtida 在命令行中 我使用 pr2

我试着读入两个文本文件,一个用UTF8编码。我在PyCharm中使用python3。在

两个文件中的示例:1.

its group are in Spain .

its group are in Antarctica .

2.

sus grupos estan en España .

sus grupos estan en Antártida .

在命令行中,我使用:

^{pr2}$

把文件读入标准输入. 在

在我的代码中,我使用以下命令来读取粘贴的文件:#!/usr/bin/env python

#coding=utf8

import itertools

import sys

for fgn_sent,eng_sent in itertools.zip_longest(*[sys.stdin]*2):

print(fgn_sent)

然后我得到一个错误:Traceback (most recent call last):

File “ibm0.py”, line 33, in

initialize_probabilities()

File “ibm0.py”, line 13, in initialize_probabilities

for fgn_sent,eng_sent in itertools.zip_longest(*[sys.stdin]*2):

File “/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/encodings/ascii.py”, line 26, in decode

return codecs.ascii_decode(input, self.errors)[0]

UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 863: ordinal not in range(128)

其中第13行是上面的for…行。在

编程小号
上一篇 2025-04-05 20:57
下一篇 2025-01-29 17:57

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/hz/130924.html