Staging
v0.5.1
Revision a8b05c4b9727ed7033840a44a67f2ee3d332ab24 authored by Miss Islington (bot) on 02 September 2020, 13:28:59 UTC, committed by GitHub on 02 September 2020, 13:28:59 UTC
(cherry picked from commit 1d25f5bf7b795b47e753aca56d7579d4ad7ee468)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
1 parent 77f4000
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