Skip to content

Instantly share code, notes, and snippets.

@mbrenig
Last active December 22, 2015 07:48
Show Gist options
  • Save mbrenig/6440029 to your computer and use it in GitHub Desktop.
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>
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