Staging
v0.8.1
https://github.com/python/cpython
Revision acfb5bdf150f47bac9a1baf9913f50919f7958d1 authored by Fred Drake on 03 March 2005, 17:24:20 UTC, committed by Fred Drake on 03 March 2005, 17:24:20 UTC
- function names marked with \function should include parentheses
- "standard error" instead of "stderr" for text
- a boolean parameter takes true or false values, not just True or False
1 parent 2a06df6
Raw File
Tip revision: acfb5bdf150f47bac9a1baf9913f50919f7958d1 authored by Fred Drake on 03 March 2005, 17:24:20 UTC
minor edits:
Tip revision: acfb5bd
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