python 清空文本内容

import os

# 清空文本内容
file = open( "d:\\qq.txt", "w+" )     # 文件如果不存在就创建
file.truncate()
file.close()

 

 

你可能感兴趣的:(python)