Created
May 30, 2013 01:05
-
-
Save DeronW/5675123 to your computer and use it in GitHub Desktop.
去掉文件的BOM头
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codecs | |
import os | |
includes = ['*.php', '*.html', '*.htm'] | |
for root, dirs, files in os.walk('pay.lvye.cn'): | |
for filename in files: | |
filename = os.path.join(root, filename) | |
with open(filename) as f: | |
content = f.read() | |
if content[:3] == codecs.BOM_UTF8: | |
content = content[3:] | |
print filename | |
f.write(content) | |
f.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment