1. # -*- coding: CP936 -*-
  2. import subprocess
  3. cmd="cmd.exe"
  4. begin=101
  5. end=110
  6. while begin<end:
  7. #reload(sys)
  8. #sys.setdefaultencoding('CP936')
  9. p=subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stdin=subprocess.PIPE,stderr=subprocess.PIPE)
  10. p.stdin.write("echo 你好."+str(begin)+"\n")
  11. p.stdin.close()
  12. p.wait()
  13. print"excution result:\n"
  14. pout=''.join(p.stdout.readlines())
  15. output=pout.decode('cp936').encode('utf-8')
  16. print"%s\n"% output
  17. begin=begin+1
 





相关文章:

  • 2021-12-15
  • 2021-12-09
  • 2021-12-17
  • 2021-07-01
  • 2022-01-01
  • 2021-08-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案