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

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -