Staging
v0.8.1
Revision 0e823c6efa4729f3cd19f96af82c673b10cd3ee2 authored by Miss Islington (bot) on 30 May 2018, 23:22:13 UTC, committed by GitHub on 30 May 2018, 23:22:13 UTC
(cherry picked from commit 02e2a085dc1740b1cbf4ba2ed77335c84ce8a367)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
1 parent 5191892
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