Staging
v0.5.1
Revision a0ad82959652ff64c99231f457fd740b17330514 authored by Ned Deily on 15 August 2020, 03:48:14 UTC, committed by Ned Deily on 15 August 2020, 05:08:56 UTC
Note: macOS 11 is not yet released, this release of Python is not
fully supported on 11.0, and not all tests pass.
1 parent cf79cbf
Raw File
rmpyc.py
# Remove all the .pyc files under ../Lib.


def deltree(root):
    import os
    from os.path import join

    npyc = 0
    for root, dirs, files in os.walk(root):
        for name in files:
            # to be thorough
            if name.endswith(('.pyc', '.pyo')):
                npyc += 1
                os.remove(join(root, name))

    return npyc

npyc = deltree("../Lib")
print(npyc, ".pyc deleted")
back to top