Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
Python
python delete contents of file
CEEg
Programming language:
Python
2021-06-17 04:33:07
0
Q:
python delete contents of file
shinyelf
Code:
Python
2021-07-04 14:23:33
f = open('file.txt', 'r+') f.truncate(0)
4
Drew Minto
Code:
Python
2021-02-09 05:42:51
open('file.txt', 'w').close()
4
Tags
python
file
con
Related
if file exists delete python
how to delete everything on a file python
how to get python to extract information from a text file
delete file python
python delete all data from file
how to read text file in python
how to delete file in python
python delete all files in directory
python glob how to read all txt files in folder
python read file in string list
python os remove file
clearing all text from a file in python
delete contents of directory python
python reading lines from a text file
python extract tar file
python read entire file
python delete file
how to write to a file in python without deleting all content
python delete file with extension
New to Communities?
Join the community