Skip to content

Instantly share code, notes, and snippets.

@wuqxuan
Last active August 1, 2018 02:49
Show Gist options
  • Save wuqxuan/a692ed11baebb4913b72e290ea1ecc46 to your computer and use it in GitHub Desktop.
Save wuqxuan/a692ed11baebb4913b72e290ea1ecc46 to your computer and use it in GitHub Desktop.
python清空file
也可以使用一条命令,直接打开文件写并覆写就会清空(注意,不能使用增加参数'a')
open(filename, 'w').close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment