Last active
December 22, 2015 07:48
-
-
Save mbrenig/6440029 to your computer and use it in GitHub Desktop.
Check for uncommon characters in a specified input file. Usage: weirdcheck.py <inputfilename.txt>
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 sys | |
print "Reading from: %s" % sys.argv[1] | |
print "----------------------------------" | |
inf = open(sys.argv[1],'r') | |
for (line_no, l) in enumerate(inf.readlines()): | |
for (pos_no, c) in enumerate(l): | |
if ord(c) > 128: | |
print "%s found at line number: %s, position: %s" % (repr(c), line_no+1, pos_no+1) | |
print l | |
print (" "*pos_no + "^") | |
print "-------------------------------------" | |
print "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment