Posted: February 6, 2022 | by Michael Bright
f = open("filename.txt", "r+") f.truncate(0) f.close()
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.
How to get Current Date and Time in Python
How to Delete a File or Folder in Python