SyntaxFix
Write A Post
Hire A Developer
Questions
This is probably because an empty line at the end of your input file.
Try this:
for x in f: try: print int(x.strip(),16) except ValueError: print "Invalid input:", x