Staging
v0.5.1
https://github.com/python/cpython
Revision 89f132a3286640b764a69b8945cbb3a499ad6bab authored by Miss Islington (bot) on 17 September 2019, 05:04:19 UTC, committed by Stéphane Wirtel on 17 September 2019, 05:04:19 UTC
(cherry picked from commit 63dedef48bba9d54f13b958237696505fa665796)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
1 parent 523497c
Raw File
Tip revision: 89f132a3286640b764a69b8945cbb3a499ad6bab authored by Miss Islington (bot) on 17 September 2019, 05:04:19 UTC
Doc: Add list(dict) in stdtypes library (GH-16209) (GH-16211)
Tip revision: 89f132a
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