Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
numBads = 0
with open(filename, encoding="utf-8", errors="strict") as f:
while True:
try:
line = f.readline()
if not line:
break
print(line)
except UnicodeDecodeError:
numBads += 1
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.