Staging
v0.5.1
https://github.com/python/cpython
Revision 86150d39c888579b65841f4391d054b7b3eff9f2 authored by Yurii Karabas on 29 November 2020, 12:50:57 UTC, committed by GitHub on 29 November 2020, 12:50:57 UTC
1 parent c642374
Raw File
Tip revision: 86150d39c888579b65841f4391d054b7b3eff9f2 authored by Yurii Karabas on 29 November 2020, 12:50:57 UTC
bpo-42392: Remove deprecated loop parameter from docs (GH-23552)
Tip revision: 86150d3
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