当前位置:编程学习 > python >>

python实现tee命令

import sys

class _tee(file):
 def write(self, text):
  sys.stdout.write(text)
  file.write(self, text)
line = sys.stdin.readline()
t = _tee(sys.argv[2], "a")
t.write(line) # for write
#print >> t, line # for print

补充:Web开发 , Python ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,