Skip to content

Instantly share code, notes, and snippets.

@Brookke
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Brookke/7c81b563b690f47dc586 to your computer and use it in GitHub Desktop.
Save Brookke/7c81b563b690f47dc586 to your computer and use it in GitHub Desktop.
Replaces colour to color in css files.
import os
oldfilename = 'style.css'
newfilename = 'new.css'
replacements = {'colour':'color'}
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
infile = open(os.path.join(__location__, oldfilename))
outfile = open(os.path.join(__location__, newfilename), 'w')
for line in infile:
for src, target in replacements.iteritems():
line = line.replace(src, target)
outfile.write(line)
infile.close()
outfile.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment