How delete all data from the '.txt' file using python 2? -


i want delete data data.txt file:

how can that?

with open('data.txt', 'w'): pass 

this delete contents of 'data.txt', leaving empty file. (this works in python3 too).


Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -