为什么要尝试解码此内容,就像在CP850中一样?没有理由这样做。
$ python
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
from subprocess import Popen, PIPE
command = “echo ‘���֧��ڧ��ӧѧߧڧ� �ӧ�֧ԧէ� �ߧ֧�ҧ��էڧާ�!’”
p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
out, err = p.communicate()
print out
���֧��ڧ��ӧѧߧڧ� �ӧ�֧ԧէ� �ߧ֧�ҧ��էڧާ�!
</code>
同样,在Python 3上:
$ python3.6
Python 3.6.5 (default, Mar 29 2018, 15:37:32)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
from subprocess import Popen, PIPE
command = “echo ‘���֧��ڧ��ӧѧߧڧ� �ӧ�֧ԧէ� �ߧ֧�ҧ��էڧާ�!’”
p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
out, err = p.communicate()
print(out)
���֧��ڧ��ӧѧߧڧ� �ӧ�֧ԧէ� �ߧ֧�ҧ��էڧާ�!
</code>