tee
tee用于将数据重定向到文件,同时提供一份副本作为后续命令的标准输入
~/Desktop cat code.py |tee code.copy
class A:
def __enter__(self):
a = 1
def __exit__(self):
b = 2
with A() as obj:
print(obj)
~/Desktop cat code.copy
class A:
def __enter__(self):
a = 1
def __exit__(self):
b = 2
with A() as obj:
print(obj)