在Unix shell中我可以这样做来清空一个文件:
cd /the/file/directory/ :> thefile.ext
我将如何在Python中执行此操作?
是这样os.system的方式,我不知道如何,因为我必须在彼此之后发送2个动作,即cd然后是:>.
os.system
cd
:>
python
python ×1