Staging
v0.5.1
https://github.com/python/cpython
Revision c7ff163abf428d73d4054754db3c99d06487e3ad authored by Berker Peksag on 03 March 2017, 15:07:18 UTC, committed by GitHub on 03 March 2017, 15:07:18 UTC
Allow developers to not have to either test on N Python versions or
looked through multiple versions of the docs to know whether they can
easily update.

(cherry picked from commit c643a967dd7d33ccefa5b61b38caf40b448057ce)
1 parent 2adc668
Raw File
Tip revision: c7ff163abf428d73d4054754db3c99d06487e3ad authored by Berker Peksag on 03 March 2017, 15:07:18 UTC
Add Python version since deprecation in base64 methods. (#33) (#429)
Tip revision: c7ff163
rmpyc.py
# Remove all the .pyc and .pyo files under ../Lib.


def deltree(root):
    import os
    from os.path import join

    npyc = npyo = 0
    for root, dirs, files in os.walk(root):
        for name in files:
            delete = False
            if name.endswith('.pyc'):
                delete = True
                npyc += 1
            elif name.endswith('.pyo'):
                delete = True
                npyo += 1

            if delete:
                os.remove(join(root, name))

    return npyc, npyo

npyc, npyo = deltree("../Lib")
print(npyc, ".pyc deleted,", npyo, ".pyo deleted")
back to top