http://blog.sina.com.cn/s/blog_567002510101c516.html
http://www.cnblogs.com/bsmagic/p/4392928.html
1、window上使用shell顯示中文
reload(sys)sys.setdefaultencoding('utf-8')
2、cybiwn pycharm 中顯示中文
output = line.decode('cp936').encode('utf-8') print "%s\n" % output
import subprocessimport syscmd = "cmd.exe"begin = 101end = 102while begin < end: ##blow for windows shell chinese show## #reload(sys) #sys.setdefaultencoding('utf-8') print "excution result start :\n" child = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) print "ping -n 1 -w 100 192.168.1." + str(begin) + "\n" child.stdin.write("ping -n 1 -w 100 192.168.1." + str(begin) + "\n") child.stdin.close() child.wait() print "excution result end:\n" begin += 1 #print child.stdout.readlines() for line in child.stdout.readlines(): ##blow for pycharm and cygwin show chinese# output = line.decode('cp936').encode('utf-8') print "%s\n" % output