Staging
v0.8.1
https://github.com/python/cpython
Revision 0be9ce305ff2b9e13ddcf15af8cfe28786afb36a authored by Andreas Poehlmann on 30 November 2020, 16:34:15 UTC, committed by GitHub on 30 November 2020, 16:34:15 UTC
1 parent 9f00463
Raw File
Tip revision: 0be9ce305ff2b9e13ddcf15af8cfe28786afb36a authored by Andreas Poehlmann on 30 November 2020, 16:34:15 UTC
bpo-42487: don't call __getitem__ of underlying maps in ChainMap.__iter__ (GH-23534)
Tip revision: 0be9ce3
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