python实现tee命令
程序员文章站
2022-06-01 10:28:46
import sys
class _tee(file):
def write(self, text):
sys.stdout.write(...
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