Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python delete text in text file

# Delete all text in a text file
f = open("text_file.txt", "r+")
f.truncate(0)
f.close()
Comment

PREVIOUS NEXT
Code Example
Python :: count unique values pandas 
Python :: python depth first search 
Python :: how to plotting bar on matplotlib 
Python :: matplotlib savefig not working 
Python :: python how to change back to the later directory 
Python :: pyspark left join 
Python :: random number pythob 
Python :: create a dictionary in python 
Python :: matlab to python 
Python :: run powershell script in python 
Python :: python proxy scraper 
Python :: sort a stack using recursion 
Python :: delete certain characters from a string python 
Python :: python letter to number in alphabet 
Python :: initialize dictionary to zero in python 
Python :: else if in django template 
Python :: rotate image in pygame 
Python :: create an array of n same value python 
Python :: make screen shot of specific part of screen python 
Python :: object to int and float conversion pandas 
Python :: python num perfect squares 
Python :: python 2 is no longer supported 
Python :: python get file path 
Python :: select multiple columns in pandas dataframe 
Python :: intersect in python list 
Python :: python append to 2d array 
Python :: how to capitalize the first letter in a list python 
Python :: django unique together 
Python :: Import "whitenoise.django" could not be resolved 
Python :: how to import turtle in python 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =