Skip to content

Instantly share code, notes, and snippets.

@npow
Created August 13, 2012 01:27
Show Gist options
  • Save npow/3336218 to your computer and use it in GitHub Desktop.
Save npow/3336218 to your computer and use it in GitHub Desktop.
Python sed
#!/usr/bin/env python
# -*- coding: latin1 -*-
import os
import sys
import re
FILENAME = sys.argv[1]
def main():
f = open(FILENAME)
contents = ''
for line in f:
line = line.replace('', '')
line = line.replace('document.createElement("CANVAS")', 'new TRWebchart_Shared.SharedUtilityFuncs().createCanvas()');
contents += line
f.close()
f = open(FILENAME, 'w')
f.write(contents)
f.close()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment