Staging
v0.5.1
https://github.com/python/cpython
Revision 31af1cce9d799475ba8c3dec3e239b4a75ce268f authored by Miss Islington (bot) on 18 September 2019, 04:06:53 UTC, committed by Raymond Hettinger on 18 September 2019, 04:06:53 UTC
(cherry picked from commit 272d0d017aef585acf84bb0af99a90a2a8582b2c)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
1 parent 54ba5f1
Raw File
Tip revision: 31af1cce9d799475ba8c3dec3e239b4a75ce268f authored by Miss Islington (bot) on 18 September 2019, 04:06:53 UTC
bpo-36546: No longer a need to make "data" positional only (GH-16252) (GH-16253)
Tip revision: 31af1cc
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