Revision f00703d29438b5f2e9524b04a247167f042a50ef authored by Miss Islington (bot) on 29 October 2018, 05:17:45 UTC, committed by GitHub on 29 October 2018, 05:17:45 UTC
(cherry picked from commit 53835e92d315340444e3dd083b3f69a590b00e07)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent 1a3f18e
Raw File
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