def clean_pyc(directory, path):
    """Remove all .pyc files recursively in path."""
    for file_name in directory:
        file_path = os.path.join(path, file_name)
        if file_name[-3:] == 'pyc':
            print 'deleting %s' % file_name
            os.remove(file_path)
        elif os.path.isdir(file_path):
            clean_pyc(os.listdir(file_path), file_path)
dataset/ETHPy150Open gferreira/hTools2/Lib/hTools2/modules/sysutils.py/clean_pyc/original