Python menghapus konten file
f = open('file.txt', 'r+')
f.truncate(0)
Horrible Hornet
f = open('file.txt', 'r+')
f.truncate(0)
fileVariable = open('textDocName.txt', 'r+')
fileVariable.truncate(0)
fileVariable.close()
f = open('file.txt', 'r+')
f.truncate(0) # need '0' when using r+
open('file.txt', 'w').close()