Staging
v0.5.1
Revision 0b3e1208033aa1eb5452afe9387f86f299ef24e5 authored by Miss Islington (bot) on 25 September 2018, 12:39:12 UTC, committed by GitHub on 25 September 2018, 12:39:12 UTC
(cherry picked from commit 604e7b9931f9e7881a2941816e538f5f15930db8)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
1 parent 936d740
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