Staging
v0.5.1
https://github.com/python/cpython
Revision b9d2e97601847a1845bf96e2895a6214f02b92a6 authored by Pablo Galindo on 13 February 2019, 00:45:53 UTC, committed by GitHub on 13 February 2019, 00:45:53 UTC
1 parent 3dc67d0
Raw File
Tip revision: b9d2e97601847a1845bf96e2895a6214f02b92a6 authored by Pablo Galindo on 13 February 2019, 00:45:53 UTC
Fix potential memory leak in parsetok.c (GH-11832)
Tip revision: b9d2e97
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