# -*- coding: CP936 -*-
import subprocess
cmd="cmd.exe"
begin=101
end=110
while begin<end:
#reload(sys)
#sys.setdefaultencoding('CP936')
p=subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stdin=subprocess.PIPE,stderr=subprocess.PIPE)
p.stdin.write("echo 你好."+str(begin)+"\n")
p.stdin.close()
p.wait()
print"excution result:\n"
pout=''.join(p.stdout.readlines())
output=pout.decode('cp936').encode('utf-8')
print"%s\n"% output
begin=begin+1
相关文章
- win10下的CLion控制台中文乱码终极解决方案
- 使用VSCode编写的代码中文乱码的解决方案【临时+永久】
- yii下使用oracle中文都变成问号乱码的解决方法
- Python 编码问题:‘ascii‘ codec can‘t encode characters in position 的解决方案(中文乱码终极解决方案)
- 在 xampp 下运行 mysql 数据库 中文变成‘?’号和中文乱码的解决方案(注意:针对的是 xampp 5.2 之后的版本 )
- windows下python2.7输出中文乱码的问题
- Python3 使用 logging.basicConfig() 配置输出日志中的中文乱码解决办法
- ubuntu下的火狐浏览器中文显示乱码解决方案
- Python中CGI模块中文乱码的问题解决方案
- eclipse 编辑 python 中文乱码的解决方案