Link to home
Start Free TrialLog in
Avatar of koleto115
koleto115

asked on

How to delete similar files with python?

I would like to delete similar files quietly with some extension under windows with python.

What I have up to now is this:

import os

os.system('del *.log')


But since this is shel command executed it always throw some stupid output if no files with this extension were found. How to delete files quietly from a python module?
ASKER CERTIFIED SOLUTION
Avatar of pepr
pepr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of koleto115
koleto115

ASKER

Thanks!
You are welcome. Also, have a look at the shutil module that implements a lot of functionality that is used in shell scripts (http://docs.python.org/library/shutil.html).