Staging
v0.8.1
Revision 36e1f2de0743e728a8e89d362f1b4981abfd52ae authored by Ezio Melotti on 12 February 2010, 00:31:13 UTC, committed by Ezio Melotti on 12 February 2010, 00:31:13 UTC
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78164 | ezio.melotti | 2010-02-12 02:28:42 +0200 (Fri, 12 Feb 2010) | 9 lines

  Merged revisions 78162 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78162 | ezio.melotti | 2010-02-12 01:50:57 +0200 (Fri, 12 Feb 2010) | 1 line

    #7907: fix wrong function name in doc. Patch by Brian Curtin.
  ........
................
1 parent 9419be9
Raw File
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