Super Newbie Question
Roman Neuhauser
neuhauser+python-list#python.org at sigpipe.cz
Mon Apr 4 20:02:15 EDT 2005
# joeyjwc at gmail.com / 2005-04-04 16:39:27 -0700:
> In short, how might I go about deleting just the contents of a file?
> I tried several methods with my limited knowledge but had no luck.
fd = open("your-file")
fd.truncate()
fd.close()
or open("your-file", "w").close()
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
More information about the Python-list
mailing list