Staging
v0.5.1
https://github.com/python/cpython
Revision 231fa23f3fe83ca3738727d45009916926d31216 authored by Miss Islington (bot) on 04 February 2018, 18:16:33 UTC, committed by Raymond Hettinger on 04 February 2018, 18:16:33 UTC
1 parent 3bd749b
Raw File
Tip revision: 231fa23f3fe83ca3738727d45009916926d31216 authored by Miss Islington (bot) on 04 February 2018, 18:16:33 UTC
Fix typo -- missing "not" (GH-5528) (GH-5531)
Tip revision: 231fa23
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