Staging
v0.5.0
https://github.com/python/cpython
Raw File
Tip revision: 7ea0551592d80584b318099d5ebde4e7c552679f authored by Ned Deily on 11 December 2019, 08:27:49 UTC
3.6.10rc1
Tip revision: 7ea0551
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