1 #! /usr/bin/env python2.7
5 def readFile (fileName
):
6 fh
= open(fileName
, 'rb')
11 def writeFile (fileName
, x
):
12 fh
= open(fileName
, 'wb')
16 _p
= re
.compile('\%\%([^\%]+)\%\%')
23 y
= readFile(fileName
)
24 toRepl
= "%%%%%s%%%%" % (fileName
,)
25 x
= x
.replace(toRepl
, y
)
31 if len(sys
.argv
) != 3:
32 print "usage: %s oldfile newfile" % (sys
.argv
[0],)
34 old
= readFile(sys
.argv
[1])
36 writeFile(sys
.argv
[2], new
)
38 if __name__
== '__main__':