How to empty a file using Python

前端 未结 2 526
暖寄归人
暖寄归人 2020-12-01 11:53

In the Unix shell I can do this to empty a file:

cd /the/file/directory/
:> thefile.ext

How would I go about doing this in Python?

2条回答
提交回复
热议问题