SyntaxFix
Write A Post
Hire A Developer
Questions
In python:
open('file.txt', 'w').close()
Or alternatively, if you have already an opened file:
f = open('file.txt', 'r+') f.truncate(0) # need '0' when using r+
In C++, you could use something similar.