Staging
v0.5.1
https://github.com/python/cpython
Revision 427613f005f0f412d12f0d775d2b609bae0ae1ad authored by Irit Katriel on 01 December 2020, 01:35:25 UTC, committed by GitHub on 01 December 2020, 01:35:25 UTC
1 parent 1244c81
Raw File
Tip revision: 427613f005f0f412d12f0d775d2b609bae0ae1ad authored by Irit Katriel on 01 December 2020, 01:35:25 UTC
bpo-42482: remove reference to exc_traceback from TracebackException (GH-23531)
Tip revision: 427613f
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