[ create a new paste ] login | about

Project: python
Link: http://python.codepad.org/eWcQ0Mfr    [ raw code | output | fork ]

fedecarg - Python, pasted on Jun 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'''
Clean .pyc files
I use Subversion for version control and I don't version the .pyc 
files. Before I issue the status command to see what has changed to my 
source, I issue this script to delete all the .pyc files. 
http://amix.dk/blog/viewEntry/79
'''
import os, sys

def pyc_clean(dir):
    findcmd = 'find %s -name "*.pyc" -print' % dir
    count = 0
    for f in os.popen(findcmd).readlines():
        count += 1
        print str(f[:-1])
        os.remove(str(f[:-1]))
    print "Removed %d .pyc files" % count 
if __name__ ==
    "__main__":    
    pyc_clean(".")


Output:
1
2
3
4
  Line 18
    if __name__ ==
                 ^
SyntaxError: invalid syntax


Create a new paste based on this one


Comments: