python清空文件内容


text_path="/xxx/xxx"
def clear():
with open(text_path, 'w') as f1:
f1.seek(0)
f1.truncate()
print("清空数据")

clear()