Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to empty a text file in python

file = open("sample.txt","r+")
file.truncate(0)
file.close()
Comment

PREVIOUS NEXT
Code Example
Python :: pygame left click 
Python :: create jwt token python 
Python :: avatar discord.py 
Python :: arithmetic python string 
Python :: tkinter button background color mac 
Python :: pandas sort values group by 
Python :: actual keystroke python 
Python :: one line input in python 
Python :: python os exists 
Python :: python-binance 
Python :: python tqdm while loop 
Python :: what is a good python version today 
Python :: python get news headlines 
Python :: drop columns pyspark 
Python :: change each line color as a rainbow python 
Python :: Qslider pyqt 
Python :: 1052 uri solution 
Python :: dice roller python 
Python :: remove whitespace in keys from dictionary 
Python :: how to take second largest value in pandas 
Python :: get cpu count in python 
Python :: how to convert string to date object in python 
Python :: python blowfish 
Python :: Consider using python 3 style super without arguments 
Python :: python print stderr 
Python :: python faker 
Python :: pandas series sort 
Python :: loop rought rows in pands 
Python :: cosine interpolation 
Python :: how to get location of word in list in python 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =