clearing all text from a file in python

43

how to delete everything on a file python -

f = open('file.txt', 'r+')
f.truncate(0) # need '0' when using r+

Comments

Submit
0 Comments